Author Topic: Fireball script  (Read 2798 times)

utkwes

  • Visitor
  • *
  • Posts: 13
  • SuperMarioRipoff-10% Development
    • ICQ Messenger - 150506923
    • MSN Messenger - a@utk.edu
    • AOL Instant Messenger - utkwes
    • View Profile
    • My Homepage
    • Email
Fireball script
« 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
errrr... rtfm?
Things are impossible until they are not.

cbass

  • Expert
  • Regular
  • *****
  • Posts: 97
  • script this
    • View Profile
    • Squest RPG
Re: Fireball script
« Reply #1 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.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Fireball script
« Reply #2 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.