where is the problem here ?
Icebox
Member Posts: 1,485
Platformer game , I want my character to collide with a wall from one side only , so left collide , right without collision , this is what i did but it doesnt work for some reason
I constrained my position x to game.playerX
Made a rule in the wall actor , if overlaps or collides with hero and gameplayerx is > self.position.x + (self.size.Height/2)
do nothing , otherwise collide
now when i try it , i need to keep going back and forth and jump and hit the wall two to three times until it works , am i doing something wrong ?
Comments
What is the (self.size.Height/2) for ?
I'd just use:
If overlap/collide
--if hero's X is >self.x
---- do nothing
--otherwise collide.
@Socks I did just now , it doesnt work properly , the hero passes through from the right side but gets pushed when it reaches the left side, it just skips 5 pixels
Wouldn't that be 'width' instead of "height?"
Sorry thats what I meant , " width " , i wrote height here by mistake
Take it out of the otherwise and set that in a rule with the opposite conditions. Otherwise is not good for stuff like that.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@Lost_Oasis_Games Yes your right , I did it just now and it worked but it doesnt respond too well , sometimes it doesnt trigger , it works the first 5 times but when you keep going back and forth the collision dissappears . I think its something with gamesalad.
Are they on the same layer? Try doing the code in the hero with the collide in him, as layer order could be affecting it to. Remember code fires from bottom to top in layer.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@Lost_Oasis_Games i just did the order , it improved alot , it stops once every 20 tries , if i keep repeating the same action over and over again. But much better after changing the layer order. I'll just drop it , thanks for your help
You're welcome. Yeah it sounds like a code order issue.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Alternatively you could have it collide only when the x velocity is negative.
@frd I never thought of that , thanks alot , it works and its smooth now
Great idea !
Good to hear.
Thanks Socks.
Clever!
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Thanks.