-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcarro.rb
107 lines (86 loc) · 1.76 KB
/
carro.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
class Carro
attr_reader :x, :y, :chaves, :gasolina, :bateria
attr_accessor :x, :y, :chaves, :gasolina, :bateria
def initialize(janela)
@janela = janela
@x = 2562
@y = 1500
@angulo = 0
@imagens = Gosu::Image.new(@janela,"media/carro.png", true)
@chaves = false
@gasolina = false
@bateria = false
end
def draw
imagem= @imagens
imagem.draw_rot(@x, @y, 2, @angulo)
end
def move
@y += 2
end
end
class Chaves
attr_reader :x, :y
attr_accessor :x, :y
def initialize(janela, x, y)
@janela = janela
@x = x
@y = y
@angulo = 0
@imagens = Gosu::Image.new(@janela,"media/keys.png", true)
end
def draw
imagem= @imagens
imagem.draw_rot(@x, @y, 2, @angulo)
end
end
class Gas
attr_reader :x, :y
attr_accessor :x, :y
def initialize(janela, x, y)
@janela = janela
@x = x
@y = y
@angulo = 0
@imagens = Gosu::Image.new(@janela,"media/gas.png", true)
end
def draw
imagem= @imagens
imagem.draw_rot(@x, @y, 2, @angulo)
end
end
class Battery
attr_reader :x, :y
attr_accessor :x, :y
def initialize(janela, x, y)
@janela = janela
@x = x
@y = y
@angulo = 0
@imagens = Gosu::Image.new(@janela,"media/battery.png", true)
end
def draw
imagem= @imagens
imagem.draw_rot(@x, @y, 2, @angulo)
end
end
class Msg
def initialize(janela, x, y)
@font = Gosu::Font.new(janela, Gosu::default_font_name, 20)
@x = x
@y = y
end
def draw
@font.draw("Precisa de Chaves e Gasolina", @x, @y, 10, factor_x = 1, factor_y = 1, color = 0xffff0000, mode = :default)
end
end
class Msg2
def initialize(janela, x, y)
@font = Gosu::Font.new(janela, Gosu::default_font_name, 20)
@x = x
@y = y
end
def draw
@font.draw("Precisa de Bateria", @x, @y, 10, factor_x = 1, factor_y = 1, color = 0xffff0000, mode = :default)
end
end