Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _PUSH(pos) { _pushing = true; obj.push##pos##(); }
- //_pushing is always false before this
- if(colliding)
- {
- // Horizontal Pushing
- if(Math.abs(axis.x) > PUSH_THRESHOLD)
- {
- if(_controller.isDown(Controller.LEFT) && axis.x > 0)
- _PUSH(Left);
- else if(_controller.isDown(Controller.RIGHT) && axis.x < 0)
- _PUSH(Right);
- else obj.stopPushing();
- }
- // Vertical Pushing
- else if(Math.abs(axis.y) > PUSH_THRESHOLD)
- {
- if(_controller.isDown(Controller.UP) && axis.y > 0)
- _PUSH(Up);
- else if(_controller.isDown(Controller.DOWN) && axis.y < 0)
- _PUSH(Down);
- else obj.stopPushing();
- }
- }
- else obj.stopPushing();
Advertisement
Add Comment
Please, Sign In to add comment