-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbullet.rb
More file actions
38 lines (32 loc) · 682 Bytes
/
bullet.rb
File metadata and controls
38 lines (32 loc) · 682 Bytes
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
class Bullet
def initialize(window, x, y, angle, ssj)
@image = Gosu::Image.new(window, "resources/images/callebullet.png", false)
@x = x
@y = y
@ssj = ssj
@angle = angle
@vel_x = @vel_y = 30
if @ssj
@vel_x = @vel_y = 100
@image = Gosu::Image.new(window, "resources/images/ssjcallebullet.png", false)
end
Thread.new do
sleep 0.5
@remove = true
end
end
def move
@x += Gosu::offset_x(@angle, @vel_x)
@y += Gosu::offset_y(@angle, @vel_y)
@x %= 640
@y %= 480
@vel_x *= 0.95
@vel_y *= 0.95
end
def remove?
@remove
end
def draw
@image.draw_rot(@x, @y, 1, @angle)
end
end