Need help with JUMPING (SOLVED)

Started by Snake, Fri 01/12/2006 14:23:18

Previous topic - Next topic

Snake

EDIT-- Solved 1 & 2 on my own...
EDIT-- 3 & 4 are solved...

Hey, guys.

Short and sweet:
I need my character to simply jump and be able to control him in the air.
I downloaded Bernie's module for this, it works fricken great but there's a couple problems:
1. He jumps too high - before I mess around with any numbers in the code and screw everything all up because I'm an idiot, how can I adjust this?
2. It puts the character off his orginal coordinates, thus making him stand above where he's supposed too (standing on air). When I adjust that, the module just seems to ignore it and puts him on the same coordinates every time.
3. I'd like to adjust his speed... switching different numbers around in the general setting doesn't seem to do anything [trying to work on this one]
4. This has nothing to do with jumping, but how do I make him stop moving forward when he's hit a wall? I've tried simply stoping him with the command, but of course he's gonna keep going if you're finger's still on that arrow... then he falls off the walkable area.


I only need this for one room.
I think all I need is just a head-start to adjusting these little things and I'll be all set. Usually I'm pretty good at figuring these things out over time, but this one's way over my head.
If any help, thanks in advance,


--Snake
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

SSH

I have no idea how's Bernie's code works, as I couldn't find his jumping module (hint, hint, Snake :P ), but I guess from the sound fo the problem that it uses the walkable areas to decide where to land after the jump, and that you have a walkable area above your ground that he is ending up on instead...

I dunno if bernie uses the player.z  fetaure of AGS, but if I was making some jumping, I would...

And, can't you take the wall out of the walkable area? why do you have walkable area where there is a wall anyway?
12

Snake

http://www.origamihero.com/files/plat01.scm
There's the link to his module.

Quote...you have a walkable area above your ground that he is ending up on instead...
The only walkable area in the room is one line going from one side of the screen to the other (bridge - only left and right, no up or down). Before I imported the module, the character's coordinates were perfect - character standing on the bridge. After importing he's like 4 or 5 pixels above.

Quote... can't you take the wall out of the walkable area? why do you have walkable area where there is a wall anyway?
Bernie did it so once the end of the walkable area was reached, they'd fall to the next walkable area below (ie, standing on table, walk off and land on the floor).
My walkable area goes beyond the wall since the player can go behind the wall as a "hiding spot" - but now, if you go too far and pass the end of the walkable area, he falls off the screen.
I've even tried connecting the line to both left and right sides of the screen, but he still falls off...??


Any further help, thank you,


--Snake
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

Bernie

This extension is actually more like an experiment and only allows customized controls through direct module code editing. It demonstrates a simple way of coding a platform movement.

A quick explanation of the module's values:

if gravity is lower than 0, it makes the character go up. The lower, the faster. If it's greater, the character moves down, the greater, the faster.

The walking areas are obstacles the character stands on.

xmove behaves the same way, only on the x axis. below zero is left, above zero is right.

Code: ags

if (gravity < 6) {gravity=gravity+1;}

if ((IsKeyPressed(375)==1)&&(xmove>-3)) {xmove=xmove-1;}
if ((IsKeyPressed(377)==1)&&(xmove<3)) {xmove=xmove+1;}

if ((IsKeyPressed(375)==0)&&(IsKeyPressed(377)==0)&&(xmove>0)) {xmove=xmove-1;}

if ((IsKeyPressed(375)==0)&&(IsKeyPressed(377)==0)&&(xmove<0)) {xmove=xmove+1;}


This code block checks if the character is on the ground and if it is, trigger a jump when space is pressed:

Code: ags

if (IsKeyPressed(32)==1){
 player.y=player.y+2;
 if (GetWalkableAreaAt(player.x-GetViewportX(),player.y-GetViewportY())==1) {gravity=-12;}Ã,  // jump
 player.y=player.y-2;
}


I'm unsure what you're trying to do, though. To adress your issues:

1 - change the value (-12) in the jump block. The closer to zero, the smaller the jump.
2 - the movement works on the actual x/y-point of the character. You may need to change the z-value
3 - replace the xmove values (-3, 3) with something like -2 and 2.
4 - not sure what you mean. A vertical line should stop the character from progressing.

Oh, oops! I posted this at the same time you edited your post. :D

Snake

Perfect, Bernie, thanks :)

Heh, it pisses me off to think that I didn't think of trying a vertical line (which worked of course) - I kept thinking of the walkable area as a walkable area and not a platform.... CHRIST!

And another stupid thing was that I missed the managing movement values and gravity section of the module... BLARGH! If I had noticed that I would have figured that out on my own too... :) I got him running at the perfect speed now :D

Anyway, Bernie, this module is a big help.
Thanks for the help,


--Snake
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"


Vincent

This Is Awesome Bernie ! :)
Actually,
I'm Using Your Method To Perform A Gravity Jumping :cool:
I Have A Question About This...

So Far This Implementation Work Great!
But When I Reach The End Of The Line...
Player Fall To Underground (And I Can't See Him Anymore) :)
How Should I Solve This ?
Player Should Stop His Movements Rather Than Fall
Any Kind Of Inspiration Is Very Welcome :(

SMF spam blocked by CleanTalk