Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- move : function () {
- var center = this.shape.center.move(this.speed);
- // если объект не влез по ширине - разворачиваем его по оси X
- if (!center.x.between(0,this.full.width)) {
- (this.speed.x *= -1);
- }
- // если объект не влез по высоте - разворачиваем его по оси Y
- if (!center.y.between(0,this.full.height)) {
- (this.speed.y *= -1);
- }
- return this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement