Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function Ball()
- {
- super();
- draw();
- reset();
- }
- override public function reset():void{
- super.reset();
- centerY = Config.CENTER_Y;
- centerX = Config.CENTER_X;
- }
- override public function onCollision(e:Entity):void{
- var overlap:Point = new Point(0, 0);
- if(Utilities.getOverlap(this, e, overlap)){
- x += overlap.x;
- y += overlap.y;
- var _hit:Number = ((centerY - e.top) / (e.height)-0.5);
- _vy *= -1;
- _vx *= -1;
- if (_hit > 0){
- _vx++;
- _vy++;
- }
- else{
- _vx++;
- _vy++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement