line-em-up 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/line-em-up/game_window.rb +38 -10
- data/line-em-up/lib/resolution_setting.rb +0 -1
- data/line-em-up/lib/z_order.rb +1 -1
- data/line-em-up/media/back_to_menu.png +0 -0
- data/line-em-up/media/laserbolt.png +0 -0
- data/line-em-up/media/mite.png +0 -0
- data/line-em-up/media/mite_original.png +0 -0
- data/line-em-up/media/progress_bar_0.png +0 -0
- data/line-em-up/media/progress_bar_1.png +0 -0
- data/line-em-up/media/progress_bar_10.png +0 -0
- data/line-em-up/media/progress_bar_11.png +0 -0
- data/line-em-up/media/progress_bar_12.png +0 -0
- data/line-em-up/media/progress_bar_13.png +0 -0
- data/line-em-up/media/progress_bar_14.png +0 -0
- data/line-em-up/media/progress_bar_15.png +0 -0
- data/line-em-up/media/progress_bar_16.png +0 -0
- data/line-em-up/media/progress_bar_17.png +0 -0
- data/line-em-up/media/progress_bar_18.png +0 -0
- data/line-em-up/media/progress_bar_19.png +0 -0
- data/line-em-up/media/progress_bar_2.png +0 -0
- data/line-em-up/media/progress_bar_20.png +0 -0
- data/line-em-up/media/progress_bar_3.png +0 -0
- data/line-em-up/media/progress_bar_4.png +0 -0
- data/line-em-up/media/progress_bar_5.png +0 -0
- data/line-em-up/media/progress_bar_6.png +0 -0
- data/line-em-up/media/progress_bar_7.png +0 -0
- data/line-em-up/media/progress_bar_8.png +0 -0
- data/line-em-up/media/progress_bar_9.png +0 -0
- data/line-em-up/media/rocket_launcher.png +0 -0
- data/line-em-up/media/rocket_launcher_original.png +0 -0
- data/line-em-up/media/tiny_missile.png +0 -0
- data/line-em-up/models/bomb_pack.rb +2 -1
- data/line-em-up/models/bullet.rb +86 -3
- data/line-em-up/models/bullet_open_gl_backup.rb +69 -0
- data/line-em-up/models/dumb_projectile.rb +2 -1
- data/line-em-up/models/enemy_bullet.rb +4 -3
- data/line-em-up/models/enemy_player.rb +1 -1
- data/line-em-up/models/footer_bar.rb +34 -1
- data/line-em-up/models/general_object.rb +2 -0
- data/line-em-up/models/health_pack.rb +5 -3
- data/line-em-up/models/horizontal_swarm.rb +123 -0
- data/line-em-up/models/main.rb +92 -0
- data/line-em-up/models/missile.rb +52 -5
- data/line-em-up/models/missile_boat.rb +9 -3
- data/line-em-up/models/missile_pack.rb +6 -1
- data/line-em-up/models/mite.rb +104 -0
- data/line-em-up/models/mothership.rb +4 -4
- data/line-em-up/models/player.rb +126 -40
- data/line-em-up/models/projectile.rb +28 -13
- data/line-em-up/models/rocket_launcher_pickup.rb +26 -0
- data/line-em-up/models/{enemy_homing_missile.rb → semi_guided_missile.rb} +13 -5
- data/line-em-up/models/small_explosion.rb +18 -6
- data/line-em-up/models/star.rb +7 -3
- data/menu_launcher.rb +1 -95
- metadata +35 -3
- data/line-em-up/media/bomb_original copy.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8342c51e3321fb4fece0302657a4ca034a4d78a6
|
4
|
+
data.tar.gz: 87f084f07f94bc47e837d0527cf54d3111528dcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 868ba45bb2b797f9af0b9e9fcb8377d556dc32172f6a59c3cb2bca296134573b9b62c62c55c43813599aea07e582f34e7aec2f7c6eb28542e2625597f5294f2c
|
7
|
+
data.tar.gz: 8a8b90012fae38067138062d0ab5444c45e24de6fef95a91c7ab4d4de7ceadf8df4ca7494de63ef9fdbef20e912f096604d71b8184fda52cfd379c7016eb5209
|
data/line-em-up/game_window.rb
CHANGED
@@ -109,7 +109,6 @@ class GameWindow < Gosu::Window
|
|
109
109
|
|
110
110
|
@gl_background = GLBackground.new
|
111
111
|
|
112
|
-
@player = Player.new(@scale, @width / 2, @height / 2, @width, @height)
|
113
112
|
@grappling_hook = nil
|
114
113
|
|
115
114
|
@buildings = Array.new
|
@@ -137,15 +136,19 @@ class GameWindow < Gosu::Window
|
|
137
136
|
|
138
137
|
# @boss_active_at_enemies_killed = 500
|
139
138
|
if @difficulty == 'easy'
|
140
|
-
@boss_active_at_enemies_killed =
|
141
|
-
@boss_active_at_level =
|
139
|
+
@boss_active_at_enemies_killed = 300
|
140
|
+
@boss_active_at_level = 2
|
141
|
+
@handicap = 0.3
|
142
142
|
elsif @difficulty == "medium"
|
143
143
|
@boss_active_at_level = 3
|
144
|
-
@boss_active_at_enemies_killed =
|
144
|
+
@boss_active_at_enemies_killed = 450
|
145
|
+
@handicap = 0.6
|
145
146
|
else
|
146
147
|
@boss_active_at_level = 4
|
147
148
|
@boss_active_at_enemies_killed = 700
|
149
|
+
@handicap = 1
|
148
150
|
end
|
151
|
+
@player = Player.new(@scale, @width / 2, @height / 2, @width, @height, {handicap: @handicap, max_movable_height: @height - @footer_bar.height})
|
149
152
|
|
150
153
|
@boss_active = false
|
151
154
|
@boss = nil
|
@@ -154,12 +157,22 @@ class GameWindow < Gosu::Window
|
|
154
157
|
|
155
158
|
|
156
159
|
# Switch button downs to this method
|
160
|
+
# This only triggers once during press. Use the other section for when we want it contunually triggered
|
157
161
|
def button_down(id)
|
158
162
|
# puts "HERE: #{id.inspect}"
|
159
163
|
# super(id)
|
160
164
|
if id == Gosu::MsLeft && @menu_open && @menu
|
161
165
|
@menu.clicked
|
162
166
|
end
|
167
|
+
|
168
|
+
if @player.is_alive && !@game_pause && !@menu_open
|
169
|
+
# KB_LEFT_CONTROL = 224,
|
170
|
+
if id == Gosu::KB_LEFT_CONTROL && @player.ready_for_special?
|
171
|
+
puts "Gosu::KB_LEFT_CONTROL CLICKED!!"
|
172
|
+
@player.special_attack
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
163
176
|
end
|
164
177
|
|
165
178
|
def self.reset(window, options = {})
|
@@ -283,8 +296,9 @@ class GameWindow < Gosu::Window
|
|
283
296
|
@menu_open = true
|
284
297
|
@can_open_menu = false
|
285
298
|
@menu = Menu.new(self)
|
286
|
-
@menu.add_item(Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/exit.png", false), get_center_font_ui_x, get_center_font_ui_y, ZOrder::UI, lambda { self.close }, Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/exit_hover.png", false))
|
287
299
|
@menu.add_item(Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/resume.png", false), get_center_font_ui_x, get_center_font_ui_y, ZOrder::UI, lambda { @menu_open = false; @menu = nil; @can_open_menu = true; }, Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/resume.png", false))
|
300
|
+
@menu.add_item(Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/back_to_menu.png", false), get_center_font_ui_x, get_center_font_ui_y, ZOrder::UI, lambda { self.close; Main.new.show }, Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/back_to_menu.png", false))
|
301
|
+
@menu.add_item(Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/exit.png", false), get_center_font_ui_x, get_center_font_ui_y, ZOrder::UI, lambda { self.close }, Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/exit.png", false))
|
288
302
|
# close!
|
289
303
|
end
|
290
304
|
if Gosu.button_down?(Gosu::KB_M)
|
@@ -358,10 +372,12 @@ class GameWindow < Gosu::Window
|
|
358
372
|
@player.collect_pickups(@pickups)
|
359
373
|
|
360
374
|
@enemy_projectiles.each do |projectile|
|
361
|
-
projectile.hit_object(@player)
|
375
|
+
results = projectile.hit_object(@player)
|
376
|
+
@pickups = @pickups + results[:drops]
|
362
377
|
end
|
363
378
|
@enemy_destructable_projectiles.each do |projectile|
|
364
|
-
projectile.hit_object(@player)
|
379
|
+
results = projectile.hit_object(@player)
|
380
|
+
@pickups = @pickups + results[:drops]
|
365
381
|
end
|
366
382
|
|
367
383
|
|
@@ -376,6 +392,7 @@ class GameWindow < Gosu::Window
|
|
376
392
|
@pickups = @pickups + results[:drops]
|
377
393
|
@player.score += results[:point_value]
|
378
394
|
@enemies_killed += results[:killed]
|
395
|
+
@player.add_kill_count(results[:killed])
|
379
396
|
end
|
380
397
|
|
381
398
|
|
@@ -418,10 +435,19 @@ class GameWindow < Gosu::Window
|
|
418
435
|
# @enemies.push(MissileBoat.new(@scale, @width, @height)) if rand(10) == 0
|
419
436
|
if !@boss_active && !@boss && !@boss_killed
|
420
437
|
|
438
|
+
if @player.is_alive && (@player.time_alive % 1000 == 0) # && @enemies.count <= @max_enemies
|
439
|
+
# @enemies.push(EnemyPlayer.new(@scale, @width, @height)) if @enemies.count <= @max_enemy_count
|
440
|
+
@pickups << RocketLauncherPickup.new(@scale, @width, @height)
|
441
|
+
end
|
442
|
+
if @player.is_alive && (@player.time_alive % 1300 == 0) # && @enemies.count <= @max_enemies
|
443
|
+
# @enemies.push(EnemyPlayer.new(@scale, @width, @height)) if @enemies.count <= @max_enemy_count
|
444
|
+
swarm = HorizontalSwarm.trigger_swarm(@scale, @width, @height)
|
445
|
+
@enemies = @enemies + swarm
|
446
|
+
end
|
447
|
+
|
421
448
|
if @player.is_alive && rand(@enemies_random_spawn_timer) == 0 && @enemies.count <= @max_enemies
|
422
449
|
(0..(@enemies_spawner_counter / 2).round).each do |count|
|
423
450
|
@enemies.push(EnemyPlayer.new(@scale, @width, @height)) if @enemies.count <= @max_enemy_count
|
424
|
-
# @enemies.push(MissileBoat.new(@scale, @width, @height)) if @enemies.count == 0
|
425
451
|
end
|
426
452
|
end
|
427
453
|
if @player.time_alive % 500 == 0
|
@@ -445,7 +471,6 @@ class GameWindow < Gosu::Window
|
|
445
471
|
end
|
446
472
|
end
|
447
473
|
if @boss_active_at_enemies_killed <= @enemies_killed || @boss_active_at_level <= @enemies_spawner_counter
|
448
|
-
# puts "HEREaagL #{@boss_active_at_enemies_killed} amd #{@enemies_killed} and #{@boss_active_at_level} and #{ @enemies_spawner_counter}"
|
449
474
|
@boss_active = true
|
450
475
|
end
|
451
476
|
|
@@ -554,7 +579,7 @@ class GameWindow < Gosu::Window
|
|
554
579
|
@font.draw("Score: #{@player.score}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
555
580
|
@font.draw("Level: #{@enemies_spawner_counter + 1}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
556
581
|
@font.draw("Enemies Killed: #{@enemies_killed}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
557
|
-
@font.draw("Boss Health: #{@boss.health}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00) if @boss
|
582
|
+
@font.draw("Boss Health: #{@boss.health.round(2)}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00) if @boss
|
558
583
|
if @debug
|
559
584
|
# @font.draw("Attack Speed: #{@player.attack_speed.round(2)}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
560
585
|
@font.draw("Health: #{@player.health}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
@@ -572,6 +597,9 @@ class GameWindow < Gosu::Window
|
|
572
597
|
@font.draw("pickups count: #{@pickups.count}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
573
598
|
@font.draw("buildings count: #{@buildings.count}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
574
599
|
@font.draw("Object count: #{@enemies.count + @enemy_projectiles.count + @projectiles.count + @enemy_destructable_projectiles.count + @pickups.count + @buildings.count}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
600
|
+
@font.draw("Damage Reduction: #{@player.damage_reduction.round(2)}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
601
|
+
@font.draw("Boost Incease: #{@player.boost_increase.round(2)}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
602
|
+
@font.draw("Attack Speed: #{@player.attack_speed.round(2)}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
575
603
|
@font.draw("FPS: #{Gosu.fps}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
|
576
604
|
end
|
577
605
|
@gl_background.draw(ZOrder::Background)
|
data/line-em-up/lib/z_order.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/line-em-up/models/bullet.rb
CHANGED
@@ -1,12 +1,95 @@
|
|
1
1
|
require_relative 'dumb_projectile.rb'
|
2
|
+
require 'opengl'
|
3
|
+
# require 'ruby-opengl'
|
4
|
+
# require 'glu'
|
5
|
+
# require 'glut'
|
2
6
|
|
3
7
|
class Bullet < DumbProjectile
|
4
|
-
DAMAGE =
|
5
|
-
COOLDOWN_DELAY =
|
8
|
+
DAMAGE = 3
|
9
|
+
COOLDOWN_DELAY = 20
|
6
10
|
# Friendly projects are + speeds
|
7
|
-
MAX_SPEED =
|
11
|
+
MAX_SPEED = 15
|
8
12
|
|
9
13
|
def get_image
|
14
|
+
# Gosu::Image.new("#{MEDIA_DIRECTORY}/laserbolt.png")
|
10
15
|
Gosu::Image.new("#{MEDIA_DIRECTORY}/bullet-mini.png")
|
11
16
|
end
|
17
|
+
|
18
|
+
# include Gl
|
19
|
+
# include Glu
|
20
|
+
# include Glut
|
21
|
+
|
22
|
+
|
23
|
+
def alt_draw
|
24
|
+
glClearColor(0.0, 0.2, 0.5, 1.0)
|
25
|
+
glClearDepth(0)
|
26
|
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
27
|
+
# info = @image.gl_tex_info
|
28
|
+
glDepthFunc(GL_GEQUAL)
|
29
|
+
glEnable(GL_DEPTH_TEST)
|
30
|
+
glEnable(GL_BLEND)
|
31
|
+
|
32
|
+
glMatrixMode(GL_PROJECTION)
|
33
|
+
glLoadIdentity
|
34
|
+
glTranslate(0, 0, -4)
|
35
|
+
|
36
|
+
# glEnable(GL_TEXTURE_2D)
|
37
|
+
# glBindTexture(GL_TEXTURE_2D, info.tex_name)
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
middle_x = @screen_width / 2
|
42
|
+
puts "MIDDLE X: #{middle_x}"
|
43
|
+
middle_y = @screen_height / 2
|
44
|
+
puts "MIDDLE Y: #{middle_y}"
|
45
|
+
increment_x = 1.0 / middle_x
|
46
|
+
increment_y = 1.0 / middle_y
|
47
|
+
puts "INcREMENT X : #{increment_x}"
|
48
|
+
puts "INcREMENT Y : #{increment_y}"
|
49
|
+
|
50
|
+
puts "PRE X: #{@x}"
|
51
|
+
puts "PRE Y: #{@y}"
|
52
|
+
puts "MID X: #{(@x - middle_x)}"
|
53
|
+
puts "MID Y: #{(@y - middle_y)}"
|
54
|
+
|
55
|
+
new_pos_x = (@x - middle_x) * increment_x
|
56
|
+
new_pos_y = (@y - middle_y) * increment_y
|
57
|
+
# Inverted Y
|
58
|
+
new_pos_y = new_pos_y * -1
|
59
|
+
|
60
|
+
height = @image_height.to_f * increment_x
|
61
|
+
|
62
|
+
puts "NEW POS X: #{new_pos_x}"
|
63
|
+
puts "NEW POS Y: #{new_pos_y}"
|
64
|
+
|
65
|
+
z = ZOrder::Projectile
|
66
|
+
# @image.draw(@x - get_width / 2, @y - get_height / 2, get_draw_ordering, @scale, @scale)
|
67
|
+
# gl do
|
68
|
+
# points_x = 3
|
69
|
+
# pounts_y = 10
|
70
|
+
Gosu.gl(z) do
|
71
|
+
glLineWidth(5)
|
72
|
+
glBegin(GL_LINES)
|
73
|
+
glColor3f(1.0, 0.0, 0.0)
|
74
|
+
glVertex3d(new_pos_x, new_pos_y, z)
|
75
|
+
glVertex3d(new_pos_x, new_pos_y - height, z)
|
76
|
+
# glVertex3d(new_pos_x, new_pos_y - increment_y, z)
|
77
|
+
# glVertex3d(0, 0, z)
|
78
|
+
# glVertex3d(1, 0, z)
|
79
|
+
glEnd
|
80
|
+
end
|
81
|
+
|
82
|
+
# Gosu.gl(z) do
|
83
|
+
# glLineWidth(50)
|
84
|
+
# glColor3f(1.0, 0.0, 0.0)
|
85
|
+
# glBegin(GL_TRIANGLE_STRIP)
|
86
|
+
# glVertex3f(0, 0.0, z)
|
87
|
+
# glVertex3f(0.5, 0, z)
|
88
|
+
# glVertex3f(0.5, 0.5, z)
|
89
|
+
# glEnd
|
90
|
+
# end
|
91
|
+
|
92
|
+
# end
|
93
|
+
end
|
94
|
+
|
12
95
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# require_relative 'dumb_projectile.rb'
|
2
|
+
# require 'opengl'
|
3
|
+
# # require 'ruby-opengl'
|
4
|
+
# require 'glu'
|
5
|
+
# require 'glut'
|
6
|
+
|
7
|
+
# class BackupBullet < DumbProjectile
|
8
|
+
# DAMAGE = 3
|
9
|
+
# COOLDOWN_DELAY = 20
|
10
|
+
# # Friendly projects are + speeds
|
11
|
+
# MAX_SPEED = 15
|
12
|
+
|
13
|
+
# def get_image
|
14
|
+
# Gosu::Image.new("#{MEDIA_DIRECTORY}/bullet-mini.png")
|
15
|
+
# end
|
16
|
+
|
17
|
+
# include Gl
|
18
|
+
# include Glu
|
19
|
+
# include Glut
|
20
|
+
|
21
|
+
|
22
|
+
# def draw
|
23
|
+
# glClearColor(0.0, 0.2, 0.5, 1.0)
|
24
|
+
# glClearDepth(0)
|
25
|
+
# glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
26
|
+
# glDepthFunc(GL_GEQUAL)
|
27
|
+
# glEnable(GL_DEPTH_TEST)
|
28
|
+
# glEnable(GL_BLEND)
|
29
|
+
|
30
|
+
# glMatrixMode(GL_PROJECTION)
|
31
|
+
# glLoadIdentity
|
32
|
+
# glTranslate(0, 0, -4)
|
33
|
+
|
34
|
+
# glEnable(GL_TEXTURE_2D)
|
35
|
+
# # glBindTexture(GL_TEXTURE_2D, info.tex_name)
|
36
|
+
|
37
|
+
# z = ZOrder::Projectile
|
38
|
+
# # @image.draw(@x - get_width / 2, @y - get_height / 2, get_draw_ordering, @scale, @scale)
|
39
|
+
# # gl do
|
40
|
+
# # points_x = 3
|
41
|
+
# # pounts_y = 10
|
42
|
+
# # Gosu.gl(z) {
|
43
|
+
# # # glColor3f(r,g,b);
|
44
|
+
# # 0.upto(pounts_y) do |y|
|
45
|
+
# # 0.upto(points_x) do |x|
|
46
|
+
# # # glColor3f(1.0, 1.0, 0.0)
|
47
|
+
# # glColor4d(1, 0, 0, z)
|
48
|
+
# # glBegin(GL_LINES)
|
49
|
+
# # glColor3f(1.0, 0.0, 0.0)
|
50
|
+
# # glVertex3d(@x + x, @y + y, z)
|
51
|
+
# # # glVertex3d(@x - 5, @y , z)
|
52
|
+
# # glEnd
|
53
|
+
# # end
|
54
|
+
# # end
|
55
|
+
# # }
|
56
|
+
|
57
|
+
# Gosu.gl(z) do
|
58
|
+
# glLineWidth(50)
|
59
|
+
# glColor3f(1.0, 0.0, 0.0)
|
60
|
+
# glBegin(GL_LINES)
|
61
|
+
# glVertex3f(0.0, 0.0, z)
|
62
|
+
# glVertex3f(15, 0, z)
|
63
|
+
# glEnd
|
64
|
+
# end
|
65
|
+
|
66
|
+
# # end
|
67
|
+
# end
|
68
|
+
|
69
|
+
# end
|
@@ -20,6 +20,7 @@ class DumbProjectile < GeneralObject
|
|
20
20
|
|
21
21
|
def initialize(scale, screen_width, screen_height, object, options = {})
|
22
22
|
options[:relative_object] = object
|
23
|
+
@damage_increase = options[:damage_increase] || 1
|
23
24
|
super(scale, object.x, object.y, screen_width, screen_height, options)
|
24
25
|
@current_speed = self.class.get_max_speed * @scale
|
25
26
|
end
|
@@ -58,7 +59,7 @@ class DumbProjectile < GeneralObject
|
|
58
59
|
hit_object = Gosu.distance(@x, @y, object.x, object.y) < self.get_radius + object.get_radius
|
59
60
|
if hit_object
|
60
61
|
if object.respond_to?(:health) && object.respond_to?(:take_damage)
|
61
|
-
object.take_damage(self.class.get_damage)
|
62
|
+
object.take_damage(self.class.get_damage * @damage_increase)
|
62
63
|
end
|
63
64
|
|
64
65
|
if object.respond_to?(:is_alive) && !object.is_alive && object.respond_to?(:drops)
|
@@ -1,10 +1,11 @@
|
|
1
1
|
require_relative 'dumb_projectile.rb'
|
2
2
|
|
3
3
|
class EnemyBullet < DumbProjectile
|
4
|
-
DAMAGE =
|
5
|
-
COOLDOWN_DELAY =
|
4
|
+
DAMAGE = 3
|
5
|
+
COOLDOWN_DELAY = 18
|
6
6
|
# Enemy y speeds are negative
|
7
|
-
MAX_SPEED = -
|
7
|
+
MAX_SPEED = -10
|
8
|
+
|
8
9
|
|
9
10
|
def get_image
|
10
11
|
Gosu::Image.new("#{MEDIA_DIRECTORY}/bullet-mini-reverse.png")
|
@@ -17,7 +17,7 @@ class EnemyPlayer < GeneralObject
|
|
17
17
|
super(scale, x || rand(screen_width), y || 0, screen_width, screen_height, options)
|
18
18
|
@cooldown_wait = 0
|
19
19
|
@attack_speed = 0.5
|
20
|
-
@health =
|
20
|
+
@health = 25
|
21
21
|
@armor = 0
|
22
22
|
@current_speed = (rand(5) * @scale).round + 1
|
23
23
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'general_object.rb'
|
2
2
|
|
3
3
|
class FooterBar < GeneralObject
|
4
|
-
attr_reader :x, :y, :living_time
|
4
|
+
attr_reader :x, :y, :living_time, :height
|
5
5
|
|
6
6
|
def initialize(scale, screen_width = nil, screen_height = nil, image = nil)
|
7
7
|
@scale = scale * 0.7
|
@@ -19,6 +19,7 @@ class FooterBar < GeneralObject
|
|
19
19
|
@health_00 = Gosu::Image.new("#{MEDIA_DIRECTORY}/health_bar_10.png")
|
20
20
|
|
21
21
|
|
22
|
+
|
22
23
|
@green_health_100 = Gosu::Image.new("#{MEDIA_DIRECTORY}/green_health_bar_0.png")
|
23
24
|
@green_health_90 = Gosu::Image.new("#{MEDIA_DIRECTORY}/green_health_bar_1.png")
|
24
25
|
@green_health_80 = Gosu::Image.new("#{MEDIA_DIRECTORY}/green_health_bar_2.png")
|
@@ -30,6 +31,20 @@ class FooterBar < GeneralObject
|
|
30
31
|
@green_health_20 = Gosu::Image.new("#{MEDIA_DIRECTORY}/green_health_bar_8.png")
|
31
32
|
@green_health_10 = Gosu::Image.new("#{MEDIA_DIRECTORY}/green_health_bar_9.png")
|
32
33
|
|
34
|
+
@progress_bar = []
|
35
|
+
@progress_bar_increments = 20
|
36
|
+
(0..20).each do |i|
|
37
|
+
@progress_bar << Gosu::Image.new("#{MEDIA_DIRECTORY}/progress_bar_#{i}.png")
|
38
|
+
end
|
39
|
+
@progress_bar_width = (@progress_bar.first.width * @scale)
|
40
|
+
@progress_bar_height = (@progress_bar.first.height * @scale)
|
41
|
+
|
42
|
+
# Right in the middle of the screen
|
43
|
+
@progress_bar_x = (screen_width / 2) - @progress_bar_width / 2
|
44
|
+
# Lets see how it looks without padding
|
45
|
+
@progress_bar_y = screen_height - @progress_bar_height # - padding
|
46
|
+
|
47
|
+
|
33
48
|
@bomb_hud = Gosu::Image.new("#{MEDIA_DIRECTORY}/bomb_pack_hud.png")
|
34
49
|
@missile_hud = Gosu::Image.new("#{MEDIA_DIRECTORY}/missile_pack_hud.png")
|
35
50
|
|
@@ -78,6 +93,8 @@ class FooterBar < GeneralObject
|
|
78
93
|
@current_color.red = 51
|
79
94
|
@current_color.green = 204
|
80
95
|
@current_color.blue = 51
|
96
|
+
|
97
|
+
@height = [@missile_hud_height, @bomb_hud_height, @health_bar_height].max
|
81
98
|
# rgb(51, 204, 51)
|
82
99
|
end
|
83
100
|
|
@@ -133,6 +150,22 @@ class FooterBar < GeneralObject
|
|
133
150
|
|
134
151
|
health_image.draw(@health_bar_x, @health_bar_y, get_draw_ordering, @scale, @scale)
|
135
152
|
|
153
|
+
|
154
|
+
|
155
|
+
# progress_bar = []
|
156
|
+
# progress_bar_increments = 20
|
157
|
+
# (0..20).each do |i|
|
158
|
+
# progress_bar << Gosu::Image.new("#{MEDIA_DIRECTORY}/progress_bar_#{i}.png")
|
159
|
+
# end
|
160
|
+
# @progress_bar_width = (progress_bar.first.width * @scale)
|
161
|
+
# @progress_bar_height = (progress_bar.first.height * @scale)
|
162
|
+
index = player.kill_count * @progress_bar_increments / player.get_kill_count_max
|
163
|
+
current_progress_bar = @progress_bar[index]
|
164
|
+
current_progress_bar.draw(@progress_bar_x, @progress_bar_y, get_draw_ordering, @scale, @scale)
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
136
169
|
@bomb_hud.draw(@bomb_hud_x, @bomb_hud_y, get_draw_ordering, @scale, @scale)
|
137
170
|
# @bomb_hud_width_half = @bomb_hud_width / 2
|
138
171
|
# @bomb_hud_height_half = @bomb_hud_height /2
|
@@ -25,6 +25,7 @@ class GeneralObject
|
|
25
25
|
@x = options[:relative_object].x
|
26
26
|
@y = options[:relative_object].y
|
27
27
|
end
|
28
|
+
@x = @x + options[:relative_x_padding] if options[:relative_x_padding]
|
28
29
|
else
|
29
30
|
@x = x
|
30
31
|
@y = y
|
@@ -140,6 +141,7 @@ class GeneralObject
|
|
140
141
|
end
|
141
142
|
|
142
143
|
def self.is_angle_between_two_angles?(angle, min_angle, max_angle)
|
144
|
+
return angle if min_angle.nil? || max_angle.nil?
|
143
145
|
value = false
|
144
146
|
if angle == min_angle
|
145
147
|
value = true
|
@@ -16,16 +16,18 @@ class HealthPack < Pickup
|
|
16
16
|
end
|
17
17
|
image_rot = 12 if image_rot == 13
|
18
18
|
@image = Gosu::Image.new("#{MEDIA_DIRECTORY}/health_pack_#{image_rot}.png", :tileable => true)
|
19
|
-
@image.draw(@x - get_width / 2, @y - get_height / 2, ZOrder::Pickups)
|
19
|
+
@image.draw(@x - get_width / 2, @y - get_height / 2, ZOrder::Pickups, @scale, @scale)
|
20
20
|
# super
|
21
21
|
end
|
22
22
|
|
23
23
|
|
24
24
|
def collected_by_player player
|
25
|
-
|
25
|
+
value = player.boost_increase * HEALTH_BOOST
|
26
|
+
if player.health + value > player.class::MAX_HEALTH
|
26
27
|
player.health = player.class::MAX_HEALTH
|
27
28
|
else
|
28
|
-
|
29
|
+
|
30
|
+
player.health += value
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|