Ecernosoft Posted October 6, 2022 Share Posted October 6, 2022 3 hours ago, ZippyRedPlumber said: It worked! Thanks @Muddyfunster Now I want to make her jump here's my code sample; Is this right? If it works, and you like it, it's right! Quote Link to comment Share on other sites More sharing options...
+x=usr(1536) Posted October 6, 2022 Share Posted October 6, 2022 21 minutes ago, Ecernosoft said: If it works, and you like it, it's right! Remember that discussion you were a participant in about not over-posting? Now would be a good time to reflect upon it and put its principles into practice. 1 Quote Link to comment Share on other sites More sharing options...
Ecernosoft Posted October 6, 2022 Share Posted October 6, 2022 17 hours ago, x=usr(1536) said: Remember that discussion you were a participant in about not over-posting? Now would be a good time to reflect upon it and put its principles into practice. Yeah..... Quote Link to comment Share on other sites More sharing options...
+Muddyfunster Posted October 6, 2022 Share Posted October 6, 2022 With 21 hours ago, ZippyRedPlumber said: It worked! Thanks @Muddyfunster Now I want to make her jump here's my code sample; Is this right? i don't think the logic structure in that example would work because you are reducing heroy by 1 and then checking if heroy = heroy -55. If for example you wanted to have a fixed jump (up then down) you could use a jump counter. I think you wrote some jumping code into your Lyra game on the 2600. 7800Basic is quite similar to Batari Basic and many of those principles would work here, at least the bits for managing the jump. You would need different code to plot your sprite etc, 1 Quote Link to comment Share on other sites More sharing options...
ZippyRedPlumber Posted October 7, 2022 Author Share Posted October 7, 2022 10 hours ago, Muddyfunster said: With i don't think the logic structure in that example would work because you are reducing heroy by 1 and then checking if heroy = heroy -55. If for example you wanted to have a fixed jump (up then down) you could use a jump counter. I think you wrote some jumping code into your Lyra game on the 2600. 7800Basic is quite similar to Batari Basic and many of those principles would work here, at least the bits for managing the jump. You would need different code to plot your sprite etc, Like this, is this right? Quote dim _Bit0_Fall_in_Progress = l ;player is falling if on. dim _Bit1_FireB_Restrainer = l ;player can't hold down fire button to jump. dim _Jump_Gravity_Counter = m dim _Fall_Gravity_Counter = n ; Skips this section if fire button is not pressed. if !joy0fire1 then _Jump_Gravity_Counter=0:_Bit3_FireB_Restrainer{3}=0:goto __Skip_Jump ;Used when player moves left/right while jumping or falling. if !_Bit3_FireB_Restrainer{3} then plotsprite gfx/fire_jump.png 160A 0 1 2 3 1 ;sprite used if player isn't moving left or right. if !joy0left && !joy0right && !_Bit3_FireB_Restrainer{3} then plotsprite gfx/fire_jump.png 160A 0 1 2 3 1 ;Skips jump if player is falling. if _Bit0_Fall_in_Progress{0} then goto __Skip_Jump ;Skips jump if fire button restrainer bit is on and jump and ;fall are not happening. Fixes it so the player can't hold ;down the fire button to jump repeatedly. if _Bit3_FireB_Restrainer{3} && !_Bit0_Fall_in_Progress{0} && !_Jump_Gravity_Counter then goto __Skip_Jump ;Turns on restrainer bit for fire button. _Bit3_FireB_Restrainer{3}=1 ;Adds one to the jump counter. _Jump_Gravity_Counter=_Jump_Gravity_Counter+1 ;Resets jump counter if limit is reached and starts a fall. if _Jump_Gravity_Counter>12 then _Jump_Gravity_Counter=0:_Bit0_Fall_in_Progress{0} = 1:goto __Skip_Jump ;Jump happens here. ;Skips jump if player1 sprite is at top edge of screen. if heroy<13 then goto __Skip_Jump ;Changes speed of jump over time depending on counter number. ;Slows down the higher it goes. if _Jump_Gravity_Counter<=7 then temp6=3 if _Jump_Gravity_Counter>7 && _Jump_Gravity_Counter<=10 then temp6=2 if _Jump_Gravity_Counter>10 then temp6=1 ;Moves player1 sprite up the screen. heroy=heroy-temp6 ;Converts player0 y position to playfield y position. temp5 = (heroy-5)/8 ;``````````````````````````````````````````````````````````````` ; Checks to see if a pfpixel is in the way. ; if pfread(_Convert_X,temp5) then _Jump_Gravity_Counter=0:_Bit0_Fall_in_Progress{0} = 1:goto __Skip_Jump __Skip_Jump ;Converts sprite y position to playfield y position. temp5 = (heroy+1)/8 ; Skips section if player is jumping or pfpixel is in the way. if _Jump_Gravity_Counter || pfread(temp5) then goto __Skip_Fall_01 ;Used when player moves left/right while jumping or falling. plotsprite gfx/fire_jump.png 160A 0 1 2 3 1 ;sprite used if player isn't moving left or right. if !joy0left&&!joy0right then then plotsprite gfx/fire_jump.png 160A 0 1 2 3 1 ;Adds one to the gravity counter. _Fall_Gravity_Counter=_Fall_Gravity_Counter+1 ;Fake gravity fall (speed keeps increasing during a fall). temp6=0 if _Fall_Gravity_Counter>8 && _Jump_Gravity_Counter<=16 then temp6=1 if _Fall_Gravity_Counter>16 && _Jump_Gravity_Counter<=24 then temp6=2 if _Fall_Gravity_Counter>24 && _Jump_Gravity_Counter<=32 then temp6=3 if _Fall_Gravity_Counter>32 then temp6=4 ;Moves player down the screen. heroy=heroy+temp6 ; Lets the program know a fall is in progress. _Bit0_Fall_in_Progress{0}=1 goto __Skip_Fall_02 __Skip_Fall_01 ; Not falling. Clears related variables. _Bit0_Fall_in_Progress{0} = 0:_Fall_Gravity_Counter=0 ; Moves sprite up one pixel if player sprite touches playfield. if pfread(_Convert_X,temp5) then player0y = player0y - 1 __Skip_Fall_02 Quote Link to comment Share on other sites More sharing options...
Traxx Posted October 7, 2022 Share Posted October 7, 2022 (edited) You might want to ask Muddy(here or in pm) to show you how to use a look up table for velocity,so you can grasp the concept...that code is terrible. Edited October 7, 2022 by Traxx 1 Quote Link to comment Share on other sites More sharing options...
+Muddyfunster Posted October 7, 2022 Share Posted October 7, 2022 I'll take a look at the weekend 👍 1 Quote Link to comment Share on other sites More sharing options...
Ecernosoft Posted October 8, 2022 Share Posted October 8, 2022 18 hours ago, Muddyfunster said: I'll take a look at the weekend 👍 7800basic is such a nice tool to have. One that I unfortunately lacked... Quote Link to comment Share on other sites More sharing options...
+TwentySixHundred Posted October 10, 2022 Share Posted October 10, 2022 Hi mate i know you asked me about the jump code i used for Captain Comic and wanted advice. I have been a little busy and with that game it's kinda complicated as the jump routine is tied into the game engine physics. Basically i use an constant artificial gravity which is very useful in the long run to prevent buggy physics. You will then need collision detection so the player doesn't fall through certain maptiles or platforms ect. From there you can add some jumping physics along the lines of a jump counter like Muddy mentioned previously. If you don't tie all these physics together you will run into many bugs and headaches down the line. I know it's alot to take in and may not make any sense. I highly recommend creating some test programs and learn all these aspects of the physics individually before merging together. Start with gravity and the collision detection within the "ramcharmap" example program. The learn to counter the gravity on joyfire input and moving onto integrating restrainers for debounce along with timers ect. ramcharmap.7z I hope some of this makes sense and helps with your project. 3 Quote Link to comment Share on other sites More sharing options...
ZippyRedPlumber Posted October 26, 2022 Author Share Posted October 26, 2022 Here's two takes on adding a jump counter, both don't want to compile.... Can anybody take a look at my sloppy code to see if I did something wrong? ramcharjump_take1.bas ramcharjump_take2.bas graphics.zip Quote Link to comment Share on other sites More sharing options...
ZippyRedPlumber Posted October 30, 2022 Author Share Posted October 30, 2022 Alright, here's take number 3 & I think I managed to make the character jump. However there's a few issues, 1. Lyra can jump infinitely, a limit needs to be capped. 2. Pressing the jump button multiple times or hitting the top of the screen causes the screen to goe pink. Roms, Bas file & Gfx folder attached below rumchurjump_take3.bas.a78 rumchurjump_take3.bas.bin rumchurjump_take3.bas graphics.zip Quote Link to comment Share on other sites More sharing options...
+Karl G Posted October 31, 2022 Share Posted October 31, 2022 21 hours ago, ZippyRedPlumber said: Alright, here's take number 3 & I think I managed to make the character jump. However there's a few issues, 1. Lyra can jump infinitely, a limit needs to be capped. 2. Pressing the jump button multiple times or hitting the top of the screen causes the screen to goe pink. I see a couple of problems here. One is "jumping" is both the name of a variable, and the name of a label for a gosub target. You should rename one of these. Another issue is that you do a gosub to the "jumping" label, and there is no "return" statement. This causes a memory leak via the stack, and is likely the cause of your yellow screen of death. Finally, I noticed that the "jumping" routine is inside of the main function, so it looks like it will be hit eventually regardless of whether or not it is called. I didn't look at your code closely enough to tell if that was likely your intent or not. Edit: Technically based on how 7800basic deals with labels, it's maybe okay to have the same name for a label and a variable name, but it's still probably a bad idea for readability, if nothing else. 1 Quote Link to comment Share on other sites More sharing options...
Ecernosoft Posted November 1, 2022 Share Posted November 1, 2022 That's what I was trying to say! 1 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted November 1, 2022 Share Posted November 1, 2022 3 hours ago, Ecernosoft said: That's what I was trying to say! What were you trying to say, and where? Quote Link to comment Share on other sites More sharing options...
Ecernosoft Posted November 1, 2022 Share Posted November 1, 2022 33 minutes ago, Karl G said: What were you trying to say, and where? When I said add 6 to the Xpos I meant in tiles for when you check the collision with the background… anyway, you got it figured out, and this is a moot topic now. 1 Quote Link to comment Share on other sites More sharing options...
+Muddyfunster Posted November 1, 2022 Share Posted November 1, 2022 1 hour ago, Ecernosoft said: When I said add 6 to the Xpos I meant in tiles for when you check the collision with the background… anyway, you got it figured out, and this is a moot topic now. Maybe I'm being dumb, but I don't see how this remotely correlates with Karl's response which talks about subroutines without a return, causing code "drop through" and a crash. 1 Quote Link to comment Share on other sites More sharing options...
SlidellMan Posted November 1, 2022 Share Posted November 1, 2022 Zippy, may I suggest that you put the source code (.bas/.78b) and graphics folder into the .zip file. Aside from that, I've been trying to write my own platforming engine in 7800Basic for at least a couple of games. Quote Link to comment Share on other sites More sharing options...
Ecernosoft Posted November 1, 2022 Share Posted November 1, 2022 3 hours ago, Muddyfunster said: Maybe I'm being dumb, but I don't see how this remotely correlates with Karl's response which talks about subroutines without a return, causing code "drop through" and a crash. Oh. I was talking about the janky collision routine. Quote Link to comment Share on other sites More sharing options...
Ecernosoft Posted November 1, 2022 Share Posted November 1, 2022 (edited) 4 hours ago, Muddyfunster said: Maybe I'm being dumb, but I don't see how this remotely correlates with Karl's response which talks about subroutines without a return, causing code "drop through" and a crash. I was talking about the jank collision, not the drop through thing. Err: Sorry, the first time it didn't go through, so I tried again, and both went through. =/ Edited November 1, 2022 by Ecernosoft 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.