joeyaage Posted August 7 Share Posted August 7 ported over some raptorBasic+ code to JagStudio. This has stumped me. original raptorBasic+ : SUB moveplayer ' Handles our player movement. Can only be called after 8 frames counted. IF (pad1 BAND PAD_DOWN AND player_y%<=((239-24)<<16)) THEN RSETOBJ(block_player1%,R_sprite_y,player_y%+(4<<16)) ENDIF IF (pad1 BAND PAD_UP AND player_y%>=(24<<16)) THEN RSETOBJ(block_player1%,R_sprite_y,player_y%-(4<<16)) ENDIF IF (pad1 BAND PAD_LEFT AND player_x%=>(16<<16)) THEN RSETOBJ(block_player1%,R_sprite_x,player_x%-(4<<16)) ENDIF IF (pad1 BAND PAD_RIGHT AND player_x%=<((351-24)<<16)) THEN RSETOBJ(block_player1%,R_sprite_x,player_x%+(4<<16)) ENDIF END SUB tortoise04.abs JagStudio : SUB moveplayer ' Handles our player movement. Can only be called after 8 frames counted. IF (pad1 BAND JAGPAD_DOWN AND player_y%<=((239-24)<<16)) THEN sprite[block_player1%].y=player_y%+(4<<16) ENDIF IF (pad1 BAND JAGPAD_UP AND player_y%>=(24<<16)) THEN sprite[block_player1%].y=player_y%-(4<<16) ENDIF IF (pad1 BAND JAGPAD_LEFT AND player_x%=>(16<<16)) THEN sprite[block_player1%].x=player_x%-(4<<16) ENDIF IF (pad1 BAND JAGPAD_RIGHT AND player_x%=<((319-24)<<16)) THEN sprite[block_player1%].x=player_x%+(4<<16) ENDIF END SUB tortoise07.abs up and down works but left and right wont budge... Quote Link to comment Share on other sites More sharing options...
Sporadic Posted August 7 Share Posted August 7 (edited) The first couple of things I've noticed; In your left and right you have =< and => these would usually be <= and >= like you have for up and down . Although that's how you had them in the RB+ code too. But I'd change them around anyway just to be sure. Secondly, I assume you set player_x% and player_y% somewhere else in the code? If not then your sprite will only ever move 4 pixels in any direction from whatever those two variables are initialised as. So if you are setting them elsewhere (perhaps based on the sprite[].X and sprite[].y) then check that code to make sure you are updating the player_x% variable correctly. Edited August 7 by Sporadic 1 1 Quote Link to comment Share on other sites More sharing options...
joeyaage Posted August 8 Author Share Posted August 8 Didn't see that!! I need to read slower...Did make a difference with <= >=, etc. Also fixed a couple of typos with player_x%, player_y%. Curse copy and paste... Gold star for Sporadic!!.. thank you...all working now.. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.