#### test84

• Key Contributor
• Posts: 1328
• Karma: +0/-0
• ت
« on: Wed, Aug 15, 2012 »
Hi flixelville,

I'm making a jump pad where when player or enemies hit them, they would get jumped into the air. And they work pretty fine and here it how it works: when an entity collides with them, it would give a negative velocity on the Y-axis.

Problem is that they are placed on the ground. More precisely problem is where entities are on the ground and collide with a jump pad. What happens is I give the entity a -400 value to it's velocity.y BUT when I do the collision check with the tilemap, since entity was on the ground, it would give zero to velocity.y.

I can surely change order of collision check but first I don't like this because it makes the code more dependant on the order and second, I like to solve the problem properly, if there is such one that is.

Thanks.
blog, twitter, Check out my award winning game, Rot Gut:

#### Arkeus

• Contributor
• Posts: 321
• Karma: +1/-0
##### Re: Problem with jump pad.
« Reply #1 on: Wed, Aug 15, 2012 »
I don't remember if it was for the exact same reason, but I think a game I made that had jump pads had the jump pad also subtract 2 pixels from the y value to move it off the ground. It's small enough that you don't notice it, but it should move it out of range of colliding with the ground.

#### Tap

• Macromedia, we miss you.
• Member
• Posts: 46
• Karma: +0/-0
• Hi.
##### Re: Problem with jump pad.
« Reply #2 on: Wed, Aug 15, 2012 »
It was a bit difficult to follow your problem, but if I understand you correctly, you are relying on Flixel's collide function to see when the player walks into a jump pad.  You could code the game logic in the jump pad to check if it overlaps anything in the "falling" flxgroup.  Then, in the player class, make him join the falling group whenever his velocity.y is positive after a jump (and optionally after walking off ledges).  When he hits the ground or hits the jump pad, he should be removed from the falling group.  That's just a concept, but I think it could work.
Looking to join a talented game dev team as a programmer and/or artist.  Want to make games similar to Rogue Legacy and Terraria.

#### test84

• Key Contributor
• Posts: 1328
• Karma: +0/-0
• ت
##### Re: Problem with jump pad.
« Reply #3 on: Wed, Aug 15, 2012 »
I don't remember if it was for the exact same reason, but I think a game I made that had jump pads had the jump pad also subtract 2 pixels from the y value to move it off the ground. It's small enough that you don't notice it, but it should move it out of range of colliding with the ground.

Thanks for the hack but I'm more after a better solution but that would just do it. Maybe these things are right and I'm idealistic about programming.

It was a bit difficult to follow your problem, but if I understand you correctly, you are relying on Flixel's collide function to see when the player walks into a jump pad.  You could code the game logic in the jump pad to check if it overlaps anything in the "falling" flxgroup.  Then, in the player class, make him join the falling group whenever his velocity.y is positive after a jump (and optionally after walking off ledges).  When he hits the ground or hits the jump pad, he should be removed from the falling group.  That's just a concept, but I think it could work.

I believe there is nothing, at least logically, wrong with approach I took for checking collision and it works fine when player falls into a jump pad or jumps and lands into one, it even works when I change order of collision check lines but problem is since I do like 8 different collision check's in my PlayState's update method, since I check the collision of player with with jump pad first (and then it gets a -400 value for it's velocity.y) and THEN check the collision with the flxtiles (and since he is on the ground as of now, it would get a zero for velocity.y and that ruins the previous -400).

And as I said I can change order of collision checks but it's this way to fix yet another bug, since my bullets pushes entities around, if I check for collision against tiles as first line, then bullets can push other flxtiles into tiles but this way when I call collide against bullets and enemis, if they go into a flxtile, then in the next collide check it would get corrected and it would seem invisible to the naked eye.

Hope I could make myself clear.
blog, twitter, Check out my award winning game, Rot Gut:

#### test84

• Key Contributor
• Posts: 1328
• Karma: +0/-0
• ت
##### Re: Problem with jump pad.
« Reply #4 on: Mon, Aug 20, 2012 »
For future references, I chose Arkeus's way and worked fine so far.
blog, twitter, Check out my award winning game, Rot Gut: