Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var gravity:Number = 0;
- speed = 10;
- scale = _xscale;
- left = 0;
- right = 0;
- onEnterFrame = function(){
- placeholder._y -= gravity;
- gravity -= 2;
- if(gravity >= 25){
- gravity = 25
- }
- if (Key.isDown(Key.LEFT)) {
- left = 1;
- }
- if (left == 1 && placeholder.hitTest(_root.wall2) != true ) {
- placeholder._x -= speed;
- placeholder.gotoAndStop(2);
- _xscale = -scale;
- }
- if (Key.isDown(Key.RIGHT)) {
- right = 1;
- }
- if (right == 1 && placeholder.hitTest(_root.wall1) != true ) {
- placeholder._x += speed;
- placeholder.gotoAndStop(2);
- _xscale = +scale;
- }
- if (right == 1 && left == 1) {
- placeholder.gotoAndStop(1);
- left = 0;
- right = 0;
- }
- if(placeholder.hitTest(_root.floor1)){
- _y = 240;
- }
- else if(placeholder.hitTest(_root.floor2)){
- _y = 159;
- }
- else{
- if(Key.isDown(Key.SPACE)){
- _root.gravity = -10
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement