? Platforming And Attacks (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Platforming And Attacks

  • #1 ✎ 9 JacboyX Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Video Games I like to play video games! Hobbies I’ve got two things... One: I’m working on a test program for Rushing Blade. And building the maps for it. However the platforming program that Petit Professor made seemed a little chunky. How can I make the gravity physics and the jump look smooth? Two: I’ve made attack sprites but SPOFS might make it floppy for both directions. How can I keep the character in one spot? Posted
  • #2 ✎ 102 seggiepants For part 1, may I humbly suggest you look at my code for Find the Exit (http://smilebasicsource.com/page?pid=820), the key is: K2KYJCS. It was supposed to be somewhat easy to follow. Basically you need to have a physics system. When you have a character jump you give them a upward acceleration (this will increase velocity over time). As time passes gravity is constantly decelerating your character until they start to fall with acellerating speed. (Of course at some point you want to hit terminal velocity and not fall any faster). Having time based movement where you keep track of how long each frame takes so you can scale the physics appropriately helps here (call MILLISEC each frame and get the difference between the current and last frame). Set the character to stop or not fall when they are standing on/touching a solid platform and zero out any upward velocity if they hit their head on a solid platform. For part 2, it sounds like your sprite is not centered vertically. The easiest fix is to make sure that the middle of the torso or even just where the feet would be at rest) is centered horizontally. Since your art has already been created you may not want to edit it. If so, then you will need to keep track of things otherwise. You could try to calculate an offset value for each sprite that says what to add/subtract to keep things centered when you flip from left to right, or perhaps more simply update sphome whenever you flip the sprite. (I am not sure if SPHOME will handle flipping all by itself, it might already do that if so, just set SPHOME.) Find out the center for each direction and change it when you change directions. If the sprite is not centered due to a weapon, you may want to consider separating the weapon into its own sprite then linking it with a character sprite with splink. That should make it easier to draw the character centered horizontally. Posted
  • #3 ✎ 9 JacboyX Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Video Games I like to play video games! Hobbies Sounds good. Thanks. Posted