Class: Cursetank::TankObject
- Inherits:
-
Object
- Object
- Cursetank::TankObject
show all
- Defined in:
- lib/cursetank/tank_objects/tank_object.rb
Instance Method Summary
collapse
Constructor Details
#initialize(args = {}) ⇒ TankObject
Returns a new instance of TankObject.
8
9
10
11
12
13
14
15
16
|
# File 'lib/cursetank/tank_objects/tank_object.rb', line 8
def initialize(args={})
@frame = 0
@win = args.fetch(:window)
@pos_x = args.fetch(:pos_x, 0)
@pos_y = args.fetch(:pos_y, 0)
@dir_right = args.fetch(:dir_right, 1)
@dir_down = args.fetch(:dir_down, 1)
@maxframes = frames.length
end
|
Instance Method Details
#draw ⇒ Object
30
31
32
|
# File 'lib/cursetank/tank_objects/tank_object.rb', line 30
def draw
raise Exception("draw method not implemented!")
end
|
#frames ⇒ Object
26
27
28
|
# File 'lib/cursetank/tank_objects/tank_object.rb', line 26
def frames
[]
end
|
#set_direction ⇒ Object
18
19
20
21
22
23
|
# File 'lib/cursetank/tank_objects/tank_object.rb', line 18
def set_direction
@dir_right = -1 if @swin.begx >= @win.maxx - 10
@dir_right = 1 if @swin.begx <= 5
@dir_down = -1 if @swin.begy >= @win.maxy - 10
@dir_down = 1 if @swin.begy <= 5
end
|