Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411573 Posts in 69386 Topics- by 58444 Members - Latest Member: darkcitien

May 04, 2024, 12:45:44 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Jump through platforms
Pages: [1]
Print
Author Topic: Jump through platforms  (Read 1294 times)
Ben_Hurr
Level 10
*****


nom nom nom


View Profile
« on: March 11, 2010, 11:01:40 AM »

How would some of you guys go about this?
Because I've been trying to make them for days. Panda

I suppose it's just a problem of keeping things out on only one side;
Logged
Noisefever
Guest
« Reply #1 on: March 11, 2010, 11:12:57 AM »

the way I have chosen:

store the last position of your player (always). if the player collide with a jumpthrou block, then check if he collided at the last position.

collided: continue falling
not collided: check player direction. if downwards, then he have stop on the block (move him out upwards). any other direction but NOT down: continue falling.

I hope I remember that correctly.
Logged
Ishi
Pixelhead
Level 10
******


coffee&coding


View Profile WWW
« Reply #2 on: March 11, 2010, 12:58:18 PM »

Yeah it's all about checking the previous position against current position (or current position against next position depending how the collision works).

Or another way to look at it is, if the player is moving down, the height of the platform's collision = the player's Y movement per frame.
Logged

Ben_Hurr
Level 10
*****


nom nom nom


View Profile
« Reply #3 on: March 12, 2010, 07:30:38 AM »

Ah, but what if you stack those jump through tiles on top of one another?
Then by how you folks are doing it, if the player overlaps another jump-through tile with any other part itself, it'll fall through the tile it's standing on right? :V
Logged
Noisefever
Guest
« Reply #4 on: March 12, 2010, 07:42:12 AM »

not if you check tile for tile (on a tile based map of course). i don't know how you check your collisions, but looking only for a collision "group" is generally a bad idea i think. if you have only pixel based collisions this will not work. and i don't know a way to do this with only pixel collisions.
Logged
droqen
Level 10
*****


View Profile WWW
« Reply #5 on: March 12, 2010, 11:41:43 AM »

As long as you don't move the player before checking for collisions, you can just test collisions only on tiles who are below the player.

That is, you only check a tile "Tile" for collision when Tile.Top <= Player.Bottom, except using variables that actually exist (unless you're using Visual Basic :3).
Logged

Ishi
Pixelhead
Level 10
******


coffee&coding


View Profile WWW
« Reply #6 on: March 12, 2010, 11:45:11 AM »

In the past I've moved the player, then checked whatever tile their feet are overlapping. As long as the player isn't moving more than one tile per frame it's fine.
Logged

Ben_Hurr
Level 10
*****


nom nom nom


View Profile
« Reply #7 on: March 12, 2010, 08:59:49 PM »

Thankfully I already figured out how to do it on my own. :3c
But thank you for the help anyway.

God I should really post this thing in DevLogs or the feedback board.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic