Author Topic: grappling hook  (Read 2964 times)

bat

  • Fanatic
  • ***
  • Posts: 234
  • Cheak out the B*t project
    • MSN Messenger - ethanbatmay@hotmail.com
    • Yahoo Instant Messenger - ethanbatmay
    • View Profile
    • The B*t project
    • Email
grappling hook
« on: 2005-11-22, 05:54:22 PM »
>>anyone have any ideas on how to make a grappling hook for a side-scrolling game?
~bat

billybob884

  • Contributor
  • Fanatic
  • **
  • Posts: 355
    • AOL Instant Messenger - billybob884
    • View Profile
grappling hook
« Reply #1 on: 2005-11-22, 06:17:53 PM »
scripting...senses..tingling!
"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." :: Hitchhiker's Guide to the Galaxy

cbass

  • Expert
  • Regular
  • *****
  • Posts: 97
  • script this
    • View Profile
    • Squest RPG
grappling hook
« Reply #2 on: 2005-11-22, 07:58:05 PM »
It probably depends on how realistic you want it.

I'm assuming you want a super metroid or super castlevainia like grapling hook, and not just a simple ladder creator.

Going for a realistic look, where the player swings a semi circle around a fixed point (where the hook is attached)  you are talking some pretty complicated scripting.

Once the grapling hook sprite contacts the attach tile or sprite, I would switch the player sprite template to inert and start controling everything through script, including gravity.  You would have to store variables for rotational velocity that is effected only by the left right keys and gravity.  Just to display the rope you would need a 36 state rope sprite who's state and location are both controled by player location in script.  When the player lets go of the button that holds the player to the hook, the sprite could switch back to SGDK control after the appropriate velocity is set (which is determined by rotational velocity and relative position or angle to the center point of the semi circle)

The things that can complicate it are numberous.  keeping collisions with sprites and solidity with tiles.  A varying sized rope controled by player (up and down keys)  Even the interaction between the grapling hook and the hook-to tile could be tricky.  Another issue I noticed is the inability to us some keys when holding down 2 arrow keys at the same time, so the good ol computer keyboards as in input device might stop us here.

I might try to tackle it someday when i start my side scroller, but i could see it taking me weeks to implement.


Going the simple route:
If you are going for no player control or eye candy, it would be pretty staight forward to just have a tile interaction between the hook sprite and the hook-to tile that starts a series of special functions that have the player swing through the air in 2 or more graphic frames and land safely on the other side every time, but that wouldnt be too much fun:)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
grappling hook
« Reply #3 on: 2005-11-23, 05:54:39 AM »
:o Uf Da!  Not only do I not want to tackle this problem without scripting.  I don't think I would even want to tacke this problem in SGDK 1.x at all.  I don't think I would even want to tackle this problem in flat SGDK 2.0.  I would want to rely on SGDK2.0 customization code (aka "scripting").  Grappling hooks are relatively complicated because they are not composed of tiles and they change all the rules of the game temporarily.  And you'd have to try really hard if you want to try to make them out of tiles.  SGDK 1.x (even scripting) can't do any graphics that aren't composed of tiles.  The only way you could draw non-tile graphics (other than drawing text) is customizing an SGDK 1.x project with external compiled code (like VB6), taking advantage of the GetDC function of the BMDXDisplay object.