PLatform Game Help Request

Non-platform specific questions.

PLatform Game Help Request

Postby foleyjo » Tue Jun 14, 2011 9:13 am

Hi all

Just after a bit of help. I'm currently looking at platform games and am having a bit of trouble with the collision detection of the floor and was wondering if someone could take a quick look and tell me what I'm doing wrong.

I'm going for a Jet Set Willy type game so the player must be able to
- Walk left to right and jump.
- Walk through platform and has the ability to jump up through them to land on them
- walk diagnoly up and down ladders

So far the player keeps getting his feet going through the floor
player ignores the steps
When jumping up to a platform he ends the jump early when he collides with the platform

Tiles1 = Tiles that the player can not pass at all
WalkTiles = Tiles the player can walk on
StepTiles = Tiles used for stairs that the player can walk up and down
DeathTiles = Tiles that kill

I apologise in advance for any messy code and lack of comments
Attachments
Wan.zip
(401.88 KiB) Downloaded 77 times
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: PLatform Game Help Request

Postby Jagmaster » Tue Jun 14, 2011 12:46 pm

I have a quick answer to one of your problems.

Collision -> top side of walk tile.
Code: Select all
if(yvelocity >=0)
{
PhysicalResponse(blah, blah, blah)
}

This will only make the guy land on the platform if he is falling.

I didn't download your example yet, but this might be of use.
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: PLatform Game Help Request

Postby savvy » Tue Jun 14, 2011 4:26 pm

also try jagmasters code plus this for added specials..

Code: Select all
if(yvelocity >=0&&y<collide.y-(height/2))
{
PhysicalResponse(blah, blah, blah)
}

the added && will make sure the player is its own height above the platform.
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: PLatform Game Help Request

Postby Jagmaster » Tue Jun 14, 2011 7:01 pm

Yes, that would be handy for a tall character. :)
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: PLatform Game Help Request

Postby foleyjo » Wed Jun 15, 2011 11:40 am

Thanks guys.

That works for the jumping and landing

but.... (and theres always a but :( )

The players characters head sometimes needs to pass through ledges.

Now using the technique you provided when the players head touches a ledge he automatically jumps up to the top of the ledge.
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: PLatform Game Help Request

Postby Jagmaster » Wed Jun 15, 2011 2:29 pm

Try making the player a parent of a region actor and give all events to this actor instead of the big animation guy.
Also, I like to add a solid actor to the edge of the un-solid actor.

Here is an example I got to work.
sample.ged
(4.71 KiB) Downloaded 81 times
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: PLatform Game Help Request

Postby lcl » Wed Jun 15, 2011 3:36 pm

savvy wrote:also try jagmasters code plus this for added specials..

Code: Select all
if(yvelocity >=0&&y<collide.y-(height/2))
{
PhysicalResponse(blah, blah, blah)
}

the added && will make sure the player is its own height above the platform.

That won't work with tile actors.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: PLatform Game Help Request

Postby foleyjo » Wed Jun 15, 2011 4:27 pm

lcl wrote:
savvy wrote:also try jagmasters code plus this for added specials..


That won't work with tile actors.


LCL - Why not? It appears to be working?

Jagmaster - thanks again for that seems to do the trick. So the player now walks on platforms as he should and jumps correctly.

Just need to work out how to make him go up and down steps.

I'm including the update .ged file with the changes made from here
Attachments
Wanlev.ged
(17.06 KiB) Downloaded 64 times
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: PLatform Game Help Request

Postby lcl » Thu Jun 16, 2011 12:47 pm

It won't work with tile actors because collide.y means collide actors (your land actors) y position.
And tile actor has one y value and if tiles make platforms at different y positions the collide.y value is still the same, the whole tile actors y.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: PLatform Game Help Request

Postby foleyjo » Thu Jun 16, 2011 1:04 pm

I see. I think I have just come into that problem with steps. It explains the mad results I was getting.

But for the floor platforms it appears to be working. I'll probably run into problems though.
Is there anything you can suggest as an alternative?


On a different note I got my character walking up and down steps by using

collision left/right of steps
y -=10;
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: PLatform Game Help Request

Postby Jagmaster » Thu Jun 16, 2011 1:45 pm

For me, I just skip the &&collide.y part. In the if statement, make sure the yvelocity conditional statement is twice as much as your gravity.
Code: Select all
if(yvelocity=gravity*2)
{
//
}

this will not work if you set yvelocity to 0 upon collision.

For stairs, I'm not sure if it's possible to make an actor go through the bottom and land on the top because you need it to collide on all sides.
A simple method would be:

1- make a dummy actor that looked like stairs.

2- make a tile that is a right triangle and set visibility state to don't draw but allow elements.

3- possibly make your "player armature" look like this
armature.png
armature.png (212 Bytes) Viewed 1560 times
and make it the size you want.
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: PLatform Game Help Request

Postby foleyjo » Thu Jun 16, 2011 4:05 pm

Again thanks.

I've changed things about and now can walk around and walk up and down stairs (though haven't used the jagmaster method ..yet)

It's not perfect but it is getting there. At least he has stopped falling through the floor.
I'm going to mess about with things and see what difference it makes.
Attachments
Wan.rar
(317.1 KiB) Downloaded 79 times
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest