Hello everybody reading this, I have started on a new game.
Its a platform game with scrolling and stuff!
There's only one problem... I made a ramp about 45 degrees angle.
the strange thing is, I am using the same script I always use and when It goes up the ramp he gets pushed back down. It doesn't usually do this!!
It might not have something to do with the script of the player but here:
Code:onClipEvent(load){ screenspeed = 5; lastpressed = "l"; moveSpeed = 10; radius = _width/2 - 1; radius2 = _height/2 - 1; gravity=10; jpower = 15; startJumpHeight=jpower+gravity; jumpHeight=0; jumping=false; lastdid = moveSpeed; } onClipEvent(enterFrame){ if(_y>250){ _y = 250; _root.walls._y-=10; } if(_y<100){ _y = 100; _root.walls._y+=10; } if(_x<100){ _x = 100; _root.walls._x+=10; } if(_x>450){ _x = 450; _root.walls._x-=10; } _y+=gravity; if(jumping){ _y -= jumpHeight; jumpHeight--; } if(jumping){ if(lastpressed=="l"){ gotoAndStop("jumpleft"); }else if(lastpressed=="r"){ gotoAndStop("jumpright"); } if(jumpHeight<=0){ airbody.play(); } }else if(lastpressed=="l"){ gotoAndStop("left"); }else if(lastpressed=="r"){ gotoAndStop("right"); } if(Key.isDown(Key.LEFT)){ body.play(); }else if(Key.isDown(Key.RIGHT)){ body.play(); } if(Key.isDown(Key.DOWN)){ }else if(Key.isDown(Key.LEFT)){ if(Key.isDown(Key.RIGHT)){ }else{ lastpressed = "l"; _x -= moveSpeed; } }else if(Key.isDown(Key.RIGHT)){ lastpressed = "r"; _x += moveSpeed; } if(Key.isDown(Key.SPACE) && !jumping){ _y -=10; jumping=true; jumpHeight=startJumpHeight; } while(_root.walls.hitTest(_x, _y+radius2, true)){ _y--; jumping=false; } while(_root.walls.hitTest(_x, _y-radius2, true)){ _y++; } while(_root.walls.hitTest(_x-radius, _y, true)){ _x++; } while(_root.walls.hitTest(_x+radius, _y, true)){ _x--; } }





Reply With Quote