-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbicho2.rb
89 lines (71 loc) · 1.73 KB
/
bicho2.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
require 'player'
class Arara
attr_reader :x, :y, :tela, :monstro2, :vivo, :pl, :speed, :player
def initialize(window)
@tela = window
@monstro2 = Gosu::Image.new(@tela, 'img/monstro2.png', true)
@vivo = true
@y = rand(@tela.height)
@ace = 0.1
@velx = 2
@vely = 2
@x = 680
@speed = @x - 10*4
end
def mover(tiro)
@x = @x - @velx
if @y > @tela.player.y
@y -= @vely
elsif @y < @tela.player.y
@y += @vely
end
if @y > @tela.width
@y = rand(@tela.width)
end
#if (@x <= 320) then
@velx += @ace
#end
# levou?(tiro)
#---------------------------------LEVELS LOGICA -------------------------------------------#
if @tela.player.pontos > 200 and @tela.player.pontos < 400
@ace = 0.2
@tela.player.estagio = 2
end
if @tela.player.pontos > 400 and @tela.player.pontos < 600
@ace = 0.3
@tela.player.estagio = 3
end
if @tela.player.pontos > 600 and @tela.player.pontos < 1000
@ace = 0.4
@tela.player.estagio = 4
end
if @tela.player.pontos >1000
@ace = 0.6
@tela.player.estagio = 5
end
#------------------------------------------------------------------------------------#
if @tela.player.pontos
if(@x <= -@mons.width)
morrer
end
end
def morrer
@tela.arara.delete(self)
@tela.player.pontos = @tela.player.pontos + 10
end
end
def getpoints
if
self.x <= 0
@tela.player.pontos = @tela.player.pontos + 10
end
end
def draw
@monstro2.draw(@x, @y, 3)
end
def levou?(tiro)
if Gosu::distance(tiro.x, tiro.y, @x, @y) < 60
morrer
end
end
end