Forum Topic: Grappling hook question

(224 views • 16 replies)

This topic is 1 page long.

<< < > >>
None

LuciousClump

Reply To Post Reply & Quote

Posted at: 1/24/09 01:37 AM

LuciousClump NEUTRAL LEVEL 05

Sign-Up: 08/26/08

Posts: 150

Ok so I'm trying to make a game , and the character has a grappling hook.
The grappling hook can only be used in certain places e.g. hanging hooks
Now I have it activate whenever the character touches the hook.
it plays the swinging animation and everything,..but the character just keeps falling
any advice??
I'm trying to make it earthworm jimish

Check out my First Song
-Crazy Scientist-


None

DanBomer

Reply To Post Reply & Quote

Posted at: 1/24/09 12:09 PM

DanBomer LIGHT LEVEL 09

Sign-Up: 04/01/06

Posts: 492

You must have a gravity or falling code in there somewhere, just set it to zero or something.

BBS Signature

None

ColdLogic

Reply To Post Reply & Quote

Posted at: 1/24/09 12:14 PM

ColdLogic EVIL LEVEL 19

Sign-Up: 11/12/03

Posts: 524

i dont know how i could help you, maybe post your code


None

zuperxtreme

Reply To Post Reply & Quote

Posted at: 1/24/09 12:39 PM

zuperxtreme NEUTRAL LEVEL 08

Sign-Up: 01/02/05

Posts: 1,625

If you're just doing it with an animation then make sure to sort of "slip a switch" when he's using the grappling hook.

Normally gravity would be applied to him so that when he jumps he comes back down, etc. But if you're using the hook make sure that gravity doesn't affect the MC so the animation can play correctly.

I'm not sure if I explain myself.

If not, try looking up pendulums. It's not easy.


None

Renandchi2

Reply To Post Reply & Quote

Posted at: 1/24/09 12:50 PM

Renandchi2 FAB LEVEL 13

Sign-Up: 07/24/08

Posts: 1,538

Post your code and an example, so we can get a better idea

Details Tutorial Collab '09! Join now!
PM me if you like my sig! Lovers so far=4
Thanks to littleMonsterGames for the inspiration to make this

BBS Signature

None

LuciousClump

Reply To Post Reply & Quote

Posted at: 1/24/09 07:54 PM

LuciousClump NEUTRAL LEVEL 05

Sign-Up: 08/26/08

Posts: 150

http://spamtheweb.com/ul/upload/240109/6 8168_BiteyGrapp2.php

Here's a quick example of our problem
the code I have for when he touches the square is

onClipEvent(enterFrame) {
if (_root.guy.hitTest(this))
_root.guy.gotoAndStop(9);
var grav = 0;
}

Check out my First Song
-Crazy Scientist-


None

Woadraiders

Reply To Post Reply & Quote

Posted at: 1/24/09 08:06 PM

Woadraiders DARK LEVEL 11

Sign-Up: 11/11/07

Posts: 561

How about storing a boolean on the player, isGrappling.
So then its something like this on the player?

if(!this.isGrappling && this.inAir)
{
      this.yvel += gravity;
}
onClipEvent(enterFrame) {
if (_root.guy.hitTest(this))
_root.guy.gotoAndStop(9);
_root.guy.isGrappling = true;
}

Mibbygames.com
panterA

BBS Signature

None

LuciousClump

Reply To Post Reply & Quote

Posted at: 1/24/09 08:14 PM

LuciousClump NEUTRAL LEVEL 05

Sign-Up: 08/26/08

Posts: 150

At 1/24/09 08:06 PM, Woadraiders wrote: How about storing a boolean on the player, isGrappling.
So then its something like this on the player?

if(!this.isGrappling && this.inAir)
{
this.yvel += gravity;
}

onClipEvent(enterFrame) {
if (_root.guy.hitTest(this))
_root.guy.gotoAndStop(9);
_root.guy.isGrappling = true;
}

it kinda worked i set the gravity to 0 and everything , but now he just falls slower

Check out my First Song
-Crazy Scientist-


None

LuciousClump

Reply To Post Reply & Quote

Posted at: 1/24/09 08:52 PM

LuciousClump NEUTRAL LEVEL 05

Sign-Up: 08/26/08

Posts: 150

also, any comments on the engine so far??

Check out my First Song
-Crazy Scientist-


AntiAliasProductionz DARK LEVEL 08

Sign-Up: 04/20/08

Posts: 318

At 1/24/09 08:52 PM, LuciousClump wrote: also, any comments on the engine so far??

I would have sex with this game if it gets completed. If you made everything I saw there, OH MAN WOULD I LOVE THIS GAME!


None

DawnOfDusk

Reply To Post Reply & Quote

Posted at: 1/24/09 09:00 PM

DawnOfDusk EVIL LEVEL 14

Sign-Up: 02/22/08

Posts: 1,482

Well, if he just fall lower, see where you make the characters y increase.

example...

this code wouldn't work...

grav+= 1;
Character._y += grav;
if(Grappling == true){
grav = 0;
}

But this will

grav+= 1;
if(Grappling == true){
grav = 0;
}

Character._y += grav;

It all matters where the y value is effected by gravity, that, and if the gravity increase is before the if statement.

Not a bad engine, the animations go WAY to fast. But sides that, I like.

:: AS2: Main :: AS3: Main :: C++: Main :: I speak German =3

BBS Signature

None

LuciousClump

Reply To Post Reply & Quote

Posted at: 1/25/09 01:06 AM

LuciousClump NEUTRAL LEVEL 05

Sign-Up: 08/26/08

Posts: 150

At 1/24/09 08:59 PM, AntiAliasProductionz wrote:
At 1/24/09 08:52 PM, LuciousClump wrote: also, any comments on the engine so far??
I would have sex with this game if it gets completed. If you made everything I saw there, OH MAN WOULD I LOVE THIS GAME!

well me and a friend
and we got a couple levels done already
,but we want to add a grappling hook so we're waiting til we figure out how

Check out my First Song
-Crazy Scientist-


None

LuciousClump

Reply To Post Reply & Quote

Posted at: 1/25/09 01:28 AM

LuciousClump NEUTRAL LEVEL 05

Sign-Up: 08/26/08

Posts: 150

At 1/24/09 09:00 PM, DawnOfDusk wrote: Well, if he just fall lower, see where you make the characters y increase.

example...

this code wouldn't work...

grav+= 1;
Character._y += grav;
if(Grappling == true){
grav = 0;
}

But this will

grav+= 1;
if(Grappling == true){
grav = 0;
}

Character._y += grav;

It all matters where the y value is effected by gravity, that, and if the gravity increase is before the if statement.

Not a bad engine, the animations go WAY to fast. But sides that, I like.

thx for the help
and yah maybe it is a little fast right now , but since the games usually slow down over the internet we thought we'd put it at 25 for now , and thx for your help altho not yet fixed I'm still trying to fix the hook

Check out my First Song
-Crazy Scientist-


None

Coaly

Reply To Post Reply & Quote

Posted at: 1/25/09 01:44 AM

Coaly LIGHT LEVEL 23

Sign-Up: 08/11/04

Posts: 2,833

It's probably a problem with the actual grappling code. If you post that, we could probably help easier, rather than speculating as to how you're doing it and then trying to figure out from that what might be wrong...

Zed's Dead

BBS Signature

None

Ertyguy

Reply To Post Reply & Quote

Posted at: 1/25/09 02:08 AM

Ertyguy LIGHT LEVEL 25

Sign-Up: 02/02/06

Posts: 2,180

When i played it i found that if i got the guy into the swinging animation he would jump down about as much as his height, then he would keep moving left or right if i pressed them. Posting the code would help bunches.


None

KynetiK-27

Reply To Post Reply & Quote

Posted at: 1/25/09 06:33 PM

KynetiK-27 NEUTRAL LEVEL 10

Sign-Up: 07/23/06

Posts: 740

I have recently made a grappling hook system, and for the most part works quite well

Platformer with GrapHook

If you are interested I can give you a hand over PM


None

Yambanshee

Reply To Post Reply & Quote

Posted at: 1/26/09 09:07 AM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,587

i think i know your problem. The place where the grappling hook is, and where his arm is when its touching te place is diffrent, so as soon as he's grapplingthe hitTest returns false. i not sure thoug, but thats what it looks like

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 12:28 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!