Author Topic: Zindel  (Read 6021 times)

Zindel

  • Visitor
  • *
  • Posts: 4
    • View Profile
Zindel
« on: 2005-08-20, 09:49:22 PM »
Hello! I'm looking for a solution to get an effect of a  fan or a spring that launches a player vertically into the air. I tried using swap velocity/ B repels A, but I'm not getting the effect I would like.

Thanks in advance for any help or info ;)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Zindel
« Reply #1 on: 2005-08-21, 08:23:45 AM »
Can you describe how the effect you got differs from what you want?

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Zindel
« Reply #2 on: 2005-08-21, 09:21:55 AM »
This is done in the GameDev Academy game.  Take a look.  Basically, it switches the player sprite to a Vector sprite shooting it upwards, then, once it reaches the top, switches back to an input-controlled sprite.
Edward Dassmesser

Zindel

  • Visitor
  • *
  • Posts: 4
    • View Profile
Zindel
« Reply #3 on: 2005-08-21, 01:50:58 PM »
Ben,
Basically I'm looking for the effect of a trampaline, or in the case of my game, the player jumps on an A/C fan and it shoots him up in the air. The repel feature swaps the velocity of two sprites. If my character jumps up and onto the fan sprite, his approaching velocity isn't great enough to fling him into the air. If I jump off a high ledge down onto the fan (or run into the side of it) it flings me correctly because of the increased velocity.

I think Durnunds answer is probably the only answer outside of scripting. Just wish I knew vbs :?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Zindel
« Reply #4 on: 2005-08-21, 02:09:01 PM »
Yeah, if you make a copy of your player sprite with exactly the same states and frames (which should be easy because you can just save the same sprite with a new name by loading the old one and creating a new one based on it) then change the "controlled by" type to be a vector, you can switch to that sprite to throw the player into the air (straight up), and if you immediately switch the sprite back to a regular player (controlled by input) and retain the state, the player should be in control with the keyboard now, but still going up fast.  BTW, if you want it to behave more like a fan and less like a trampoline, you might just want to reverse gravity for a while with strategically placed special functions.

BTW, VBS shouldn't be too hard to learn from example if you want to give it a try, and we're here to answer questions (in the Script forum).  The script would be quite simple for this problem.  You could set up a special function to detect when the player touches a trampoline (which would be even easier to implement as a tile interaction or special function):
Code: [Select]
Sub Player_OnSpecialFunction(SpecialObj)
   If SpecialObj.Name = "Bounce" Then ProjectObj.GamePlayer.PlayerSprite.DY = -8
End Sub

Zindel

  • Visitor
  • *
  • Posts: 4
    • View Profile
Zindel
« Reply #5 on: 2005-08-21, 02:34:59 PM »
Thanks for the quick replies, I'll try both and see what works best  ;)