Jump to content
IGNORED

Project "tortoise". Used to work in raptorBasic+


joeyaage

Recommended Posts

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...

Link to comment
Share on other sites

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 by Sporadic
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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..

 

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...