Scrolling Game Development Kit Forum

SGDK Version 1 => Script => Topic started by: utkwes on 2006-04-15, 01:39:35 PM

Title: Fireball script
Post by: utkwes on 2006-04-15, 01:39:35 PM
As about everyone knows, lol, fireballs don't follow normal physics:

ie when they are thrown they fall to the nearest ground and then bounce along it as if they are a rubber ball.

Is there a way to implement this "rubber ball" physics in SGDK? I assume it will need a script.  If there is a way to do it without one, I am all ears. 

Thanks!

-Wes
Title: Re: Fireball script
Post by: cbass on 2006-04-16, 10:23:31 AM
this might work without script, but I haven't tested it.

make a 2 point path, 1 point then the next point about 4 horizontal screens away with no change in the vertical direction.
Create the fireball sprite with an animation and some speed, a 1 or 2 jump height(up requires solid), and some gravity value that is set to this path, no initial instance.  Set it to follow approximate path.  Deleted when off screen.

Now your special function that creates the fireball (I'm assuming the player shoots it, ala mario.  Set it to appear "relative to player"

If your player is much taller than the fireball, the fireball should be constantly jumping trying to get to the y point of the path while moving forward.

If it doesn't work, you might have to make the path many points instead of just 2.  Also, you need to do a bunch of fancy other stuff to make it so you can only have a limited number of fireballs, shoot either left or right.  Also you might have to tweak its speed, jump height, and gravity to get it to act how you want.
Title: Re: Fireball script
Post by: bluemonkmn on 2006-04-17, 06:16:37 AM
The other option is to just move the fireball up and down within the frames of the animation and have the sprite itself move straight accross the screen.