4 MyObj
.rects
= ObjectList
:new()
5 MyObj
.image
, MyObj
.w
, MyObj
.h
= get_image("data/images/wikilogo.png")
14 function MyObj
:reflect_x()
15 self
.angle
= (-1 * self
.angle
) + 180
16 self
.angle
= self
.angle
% 360
19 function MyObj
:reflect_y()
20 self
.angle
= -1 * self
.angle
21 self
.angle
= self
.angle
% 360
24 function MyObj
:update(delta
)
25 Object
.update(self
, delta
)
27 --this code is what makes it bounce
28 local cx
, cy
= Object
.get_center(self
)
31 self
.x
= 0 - math
.floor(self
.w
/2)
36 self
.x
= s_width
- math
.floor(self
.w
/2)
41 self
.y
= 0 - math
.floor(self
.h
/2)
45 if cy
>= s_height
then
46 self
.y
= s_height
- math
.floor(self
.h
/2)
52 function MyObj
:collide(ids
, object
)
53 print("Ouch! You hit me, "..object
.type.." at "..os
.time().."!")