Page 1 of 1

Characters not colliding on left & right sides of tile actor

PostPosted: Mon Apr 21, 2008 4:11 pm
by warezIbanez
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?

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

PostPosted: Wed Apr 23, 2008 1:42 pm
by Bee-Ant
Player>Collision Event>ANY SIDE of Platform>Physical Response>1 1 0 0

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

PostPosted: Wed Apr 23, 2008 11:26 pm
by warezIbanez
Nope, didn't work =/ thx for the reply, though...

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

PostPosted: Wed Apr 23, 2008 11:56 pm
by warezIbanez
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...

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

PostPosted: Mon May 05, 2008 8:47 pm
by DST
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.

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

PostPosted: Tue May 06, 2008 11:05 am
by Bee-Ant
Btw, this happen to filled region also...
ummm...walrus, are you sure make the collision event to be repeated???