Question by
FiliKowa · Apr 17, 2017 at 07:25 PM ·
c#2d game2d-platformer2d-physics
C# delaying command
So, im making a simple game, and when the character comes to the corner, he changes the direction, whats happening is that it lags when its in the corner, and i want to delay an if command, if its true, wait one second, then check if again...First i only had onwall, and grounded detection, then i added corner detection hoping it would solve the laging in the corners..
grounded = Physics2D.IsTouchingLayers (mycollider, whatisground);
onwall = Physics2D.IsTouchingLayers (mycollider, whatiswall);
cornered = Physics2D.IsTouchingLayers (mycollider, whatiscorner);
if (grounded || onwall)
{
candoublejump = true;
}
if(cornered && onwall && grounded)
{
moveSpeed = -(moveSpeed);
}
Comment
Your answer
Follow this Question
Related Questions
How to cancel the force caused by collision? So the player is not pushed away when it hits a corner? 0 Answers
What is the simplest way to get a jelly like effect in unity? 0 Answers
Values not updating in Unity. - UPDATED 1 Answer
Unity 2D : C# : Animation : CS1061 : Animation does not contain definition for SetFloat.. 1 Answer
Player can only jump once!? 0 Answers