Here is my new game SteerWheels!
You can play it here
It is a fun, interesting physics based game where you have to push the ball to the bar using the car (controlled by the arrow keys).
Welcome back, At the end of the last tutorial i wondered what would happen if we had a platform that you could jump underneath from.
In the end of the last post we had a problem where the character vibrated. This was because when ever the character touched the floor i made it move up by one pixel. to rectify this i will make another hittest that detects when the character is one pixel off the floor and only calculate the velocity of the player if it returns false.
-
<span style="color: #666666;">function run(event:Event) {</span></div>
-
<div><span style="color: #666666;"> velocity+=gravity;
-
if (land.hitTestPoint(char.x, char.y+char.height/2, true)) {
-
velocity = 0;
-
char.y--
-
}
-
if (!land.hitTestPoint(char.x, char.y+char.height/2+1, true)) {
-
char.y += velocity;
-
} else {
-
velocity=0;
-
if (attemptJump==true) {
-
char.y--;
-
velocity =-5;
-
}
-
}
-
if (goleft==true) {
-
char.x+=lspeed;
-
}
-
if (goright==true) {
-
char.x+=rspeed;
-
}
-
}


