Characters not colliding on left & right sides of tile actor

Non-platform specific questions.

Characters not colliding on left & right sides of tile actor

Postby warezIbanez » Mon Apr 21, 2008 4:11 pm

Hey, I'm building a level for my game, and as I am using tiles for the platforms on the level. I have player characters able to collide with the top and bottom of each tile; however, the characters can still go through walls through the left and right side on each tile. What are your guys' suggestions? Should I just try and add another collision event?
warezIbanez
 
Posts: 5
Joined: Thu Apr 17, 2008 2:40 pm
Score: 0 Give a positive score

Re: Characters not colliding on left & right sides of tile actor

Postby Bee-Ant » Wed Apr 23, 2008 1:42 pm

Player>Collision Event>ANY SIDE of Platform>Physical Response>1 1 0 0
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Characters not colliding on left & right sides of tile actor

Postby warezIbanez » Wed Apr 23, 2008 11:26 pm

Nope, didn't work =/ thx for the reply, though...
warezIbanez
 
Posts: 5
Joined: Thu Apr 17, 2008 2:40 pm
Score: 0 Give a positive score

Re: Characters not colliding on left & right sides of tile actor

Postby warezIbanez » Wed Apr 23, 2008 11:56 pm

I think I nearly have it... I added a collision to each player, disabling them to hit any key if they hit the sides of the platforms, and re-enabling them to continue moving once they hit the top of the "ground" actor.

If anyone has any other suggestions, let me know...
warezIbanez
 
Posts: 5
Joined: Thu Apr 17, 2008 2:40 pm
Score: 0 Give a positive score

Re: Characters not colliding on left & right sides of tile actor

Postby DST » Mon May 05, 2008 8:47 pm

The method i use for left and right collisions is to create to create three integer variables, 'speed', 'canright', and 'canleft'.
On keydown> right:
Code: Select all
x+=speed*canright;
canleft=1;

and on keydown> left
Code: Select all
x-=speed*canleft;
canright=1;

and on collision > left side of platform
Code: Select all
canright=0;

and on the right side
Code: Select all
canleft=0;


Now the reason for 'speed' is so you can give the player a speed powerup at anytime without having to go back and change all these scripts. Usually I set 'speed' to 4 and canright and canleft both to 1 on player>createactor.

So when a player runs into a wall or platform, his xvelocity in that direction is reduced to 0; and all he has to do to reenable it...is push the other direction. I used this method in Gauntlet (on the demos page).

The script in this post has changed from the gauntlet script in that i've used '*' instead of 'if'. Its less code and less work for the cpu.

If you try it you'll notice that this gives a very solid left and right collision; and the player doesn't 'bounce' off the wall, nor does he 'stick' to it. Hope this helps.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Characters not colliding on left & right sides of tile actor

Postby Bee-Ant » Tue May 06, 2008 11:05 am

Btw, this happen to filled region also...
ummm...walrus, are you sure make the collision event to be repeated???
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron