line-em-up 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/bin/line-em-up.sh +4 -0
  3. data/line-em-up/game_window.rb +444 -0
  4. data/line-em-up/irb_requirements.rb +11 -0
  5. data/line-em-up/lib/z_order.rb +3 -0
  6. data/line-em-up/media/BrokenPNG.png +0 -0
  7. data/line-em-up/media/Cursor.png +0 -0
  8. data/line-em-up/media/JingleBells.mp3 +0 -0
  9. data/line-em-up/media/JingleBells.ogg +0 -0
  10. data/line-em-up/media/Loop.wav +0 -0
  11. data/line-em-up/media/Sample.wav +0 -0
  12. data/line-em-up/media/SquareTexture.png +0 -0
  13. data/line-em-up/media/Wallpaper.png +0 -0
  14. data/line-em-up/media/WallpaperXXL.png +0 -0
  15. data/line-em-up/media/WhiteAlpha.png +0 -0
  16. data/line-em-up/media/additem.png +0 -0
  17. data/line-em-up/media/additem_hover.png +0 -0
  18. data/line-em-up/media/audio_formats/aiff_32bit_float.aiff +0 -0
  19. data/line-em-up/media/audio_formats/au_16bit_pcm.au +0 -0
  20. data/line-em-up/media/audio_formats/caf_be_16bit_44khz.caf +0 -0
  21. data/line-em-up/media/audio_formats/caf_le_16bit_44khz.caf +0 -0
  22. data/line-em-up/media/audio_formats/caf_le_8bit_44khz.caf +0 -0
  23. data/line-em-up/media/audio_formats/general_midi.mid +0 -0
  24. data/line-em-up/media/audio_formats/impulse_tracker.it +0 -0
  25. data/line-em-up/media/audio_formats/mp3_128k_stereo.mp3 +0 -0
  26. data/line-em-up/media/audio_formats/mp3_avg_96kbit_jointstereo.mp3 +0 -0
  27. data/line-em-up/media/audio_formats/ogg_vorbis.ogg +0 -0
  28. data/line-em-up/media/audio_formats/wav_16bit_pcm.wav +0 -0
  29. data/line-em-up/media/audio_formats/wav_32bit_pcm.wav +0 -0
  30. data/line-em-up/media/audio_formats/wav_4bit_ms_adpcm.wav +0 -0
  31. data/line-em-up/media/back.png +0 -0
  32. data/line-em-up/media/beep.wav +0 -0
  33. data/line-em-up/media/bomb.png +0 -0
  34. data/line-em-up/media/bomb_original.png +0 -0
  35. data/line-em-up/media/bomb_pack.png +0 -0
  36. data/line-em-up/media/building.png +0 -0
  37. data/line-em-up/media/building_original.png +0 -0
  38. data/line-em-up/media/bullet-mini-reverse.png +0 -0
  39. data/line-em-up/media/bullet-mini.png +0 -0
  40. data/line-em-up/media/bullet.png +0 -0
  41. data/line-em-up/media/chain.png +0 -0
  42. data/line-em-up/media/chain_original.png +0 -0
  43. data/line-em-up/media/cptn_ruby.png +0 -0
  44. data/line-em-up/media/cptn_ruby_map.txt +25 -0
  45. data/line-em-up/media/crosshair.png +0 -0
  46. data/line-em-up/media/cursor 2.png +0 -0
  47. data/line-em-up/media/earth.png +0 -0
  48. data/line-em-up/media/exit.png +0 -0
  49. data/line-em-up/media/exit_hover.png +0 -0
  50. data/line-em-up/media/explosion.wav +0 -0
  51. data/line-em-up/media/gem.png +0 -0
  52. data/line-em-up/media/grappling_hook.png +0 -0
  53. data/line-em-up/media/grappling_hook_original.png +0 -0
  54. data/line-em-up/media/header@2x.psd +0 -0
  55. data/line-em-up/media/health_original.png +0 -0
  56. data/line-em-up/media/health_pack_0.png +0 -0
  57. data/line-em-up/media/health_pack_1.png +0 -0
  58. data/line-em-up/media/health_pack_10.png +0 -0
  59. data/line-em-up/media/health_pack_11.png +0 -0
  60. data/line-em-up/media/health_pack_12.png +0 -0
  61. data/line-em-up/media/health_pack_2.png +0 -0
  62. data/line-em-up/media/health_pack_3.png +0 -0
  63. data/line-em-up/media/health_pack_4.png +0 -0
  64. data/line-em-up/media/health_pack_5.png +0 -0
  65. data/line-em-up/media/health_pack_6.png +0 -0
  66. data/line-em-up/media/health_pack_7.png +0 -0
  67. data/line-em-up/media/health_pack_8.png +0 -0
  68. data/line-em-up/media/health_pack_9.png +0 -0
  69. data/line-em-up/media/image_formats/test.jpg +0 -0
  70. data/line-em-up/media/image_formats/test.psd +0 -0
  71. data/line-em-up/media/item.png +0 -0
  72. data/line-em-up/media/item_hover.png +0 -0
  73. data/line-em-up/media/landscape.svg +10 -0
  74. data/line-em-up/media/large_star.png +0 -0
  75. data/line-em-up/media/missile.png +0 -0
  76. data/line-em-up/media/missile_original.png +0 -0
  77. data/line-em-up/media/missile_pack.png +0 -0
  78. data/line-em-up/media/missile_pack_original.png +0 -0
  79. data/line-em-up/media/question.png +0 -0
  80. data/line-em-up/media/question_original.png +0 -0
  81. data/line-em-up/media/resume.png +0 -0
  82. data/line-em-up/media/smoke.png +0 -0
  83. data/line-em-up/media/soldier.png +0 -0
  84. data/line-em-up/media/space.png +0 -0
  85. data/line-em-up/media/spaceship.png +0 -0
  86. data/line-em-up/media/spaceship_original.png +0 -0
  87. data/line-em-up/media/star.png +0 -0
  88. data/line-em-up/media/starfighter.bmp +0 -0
  89. data/line-em-up/media/starfighterv2.bmp +0 -0
  90. data/line-em-up/media/starfighterv4.png +0 -0
  91. data/line-em-up/media/start.png +0 -0
  92. data/line-em-up/media/tileset.png +0 -0
  93. data/line-em-up/media/vera.ttf +0 -0
  94. metadata +178 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 334ea09facdd29bc7a5f0e30da6f9e8eb364b544
4
+ data.tar.gz: 5abd1abfb1b61f25be55c4613df85674d7229d19
5
+ SHA512:
6
+ metadata.gz: afc27313a8205af621510de30dbce563d9ba7c3c9467792c9fc80c422c73974bc3fc6d9db58f8c5477f47eb8c3e999c7792be389a098b289c14f219a951d3611
7
+ data.tar.gz: dd0e11b67f3ec156d8f974df8c93bdf835bdf44aa40d76852a7ad55f290dfb095cf04b38a6327f9d8390b7460273ca1abaa32c43cd1fcd7ede0f6a00e30a30b5
data/bin/line-em-up.sh ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ SCRIPT_DIRECTORY = File.expand_path('../../', __FILE__)
3
+ require "#{SCRIPT_DIRECTORY}/menu_launcher.rb"
4
+ Main.new.show
@@ -0,0 +1,444 @@
1
+ # A simple "Triangle Game" that allows you to move a Roguelike '@' around the
2
+ # window (and off of it). This is a working example on MacOS 10.12 as of Dec 16, 2017.
3
+ # This combines some of the Ruby2D tutorial code with keypress management
4
+ # that actually works.
5
+ #
6
+ # Keys: hjkl: movement, q: quit
7
+ #
8
+ # To run: ruby triangle-game.rb after installing the Simple2D library and Ruby2D Gem.
9
+ #
10
+ # Author: Douglas P. Fields, Jr.
11
+ # E-mail: symbolics@lisp.engineer
12
+ # Site: https://symbolics.lisp.engineer/
13
+ # Copyright 2017 Douglas P. Fields, Jr.
14
+ # License: The MIT License
15
+
16
+ # require 'gosu'
17
+
18
+ # Encoding: UTF-8
19
+
20
+ # The tutorial game over a landscape rendered with OpenGL.
21
+ # Basically shows how arbitrary OpenGL calls can be put into
22
+ # the block given to Window#gl, and that Gosu Images can be
23
+ # used as textures using the gl_tex_info call.
24
+
25
+ # require 'rubygems'
26
+ require 'gosu'
27
+
28
+ CURRENT_DIRECTORY = File.expand_path('../', __FILE__)
29
+ MEDIA_DIRECTORY = File.expand_path('../', __FILE__) + "/media"
30
+
31
+ # ONLY ENABLE FOR WINDOWS COMPILATION
32
+ # Place opengl lib in lib library
33
+ # Replace the meths list iteration with the following (added rescue blocks):
34
+ # meths.each do |mn|
35
+ # define_singleton_method(mn) do |*args,&block|
36
+ # begin
37
+ # implementation.send(mn, *args, &block)
38
+ # rescue
39
+ # end
40
+ # end
41
+ # define_method(mn) do |*args,&block|
42
+ # begin
43
+ # implementation.send(mn, *args, &block)
44
+ # rescue
45
+ # end
46
+ # end
47
+ # private mn
48
+ # end
49
+ # For WINDOWS - using local lip
50
+ # require_relative 'lib/opengl.rb'
51
+ # FOR Linux\OSX - using opengl gem
52
+ require 'opengl'
53
+
54
+ Dir["#{CURRENT_DIRECTORY}/lib/*.rb"].each { |f| require f }
55
+ Dir["#{CURRENT_DIRECTORY}/models/*.rb"].each { |f| require f }
56
+
57
+ # require_relative 'media'
58
+ # Dir["/path/to/directory/*.rb"].each {|file| require file }
59
+ #
60
+ # exit if Object.const_defined?(:Ocra) #allow ocra to create an exe without executing the entire script
61
+
62
+
63
+ WIDTH, HEIGHT = 640, 480
64
+
65
+ RESOLUTIONS = [[640, 480], [800, 600], [960, 720], [1024, 768], [1280, 960], [1400, 1050], [1440, 1080], [1600, 1200], [1856, 1392], [1920, 1440], [2048, 1536]]
66
+ # RESOLUTIONS = [[640, 480], [800, 600], [960, 720], [1024, 768]]
67
+ # WIDTH, HEIGHT = 1080, 720
68
+
69
+ class GameWindow < Gosu::Window
70
+ attr_accessor :width, :height, :block_all_controls
71
+
72
+ # Switch button downs to this method
73
+ def button_down(id)
74
+ # puts "HERE: #{id.inspect}"
75
+ # super(id)
76
+ if id == Gosu::MsLeft && @menu_open && @menu
77
+ @menu.clicked
78
+ end
79
+ end
80
+
81
+ def self.reset(window)
82
+ window = GameWindow.new.show
83
+ end
84
+
85
+
86
+ def self.start width = nil, height = nil, options = {}
87
+ # window = GameWindow.new.show
88
+ GameWindow.new(width, height, options).show
89
+ end
90
+
91
+ # When fullscreen, try to match window with screen resolution
92
+ # .screen_height ⇒ Integer
93
+ # The height (in pixels) of the user's primary screen.
94
+ # .screen_width ⇒ Integer
95
+ # The width (in pixels) of the user's primary screen.
96
+
97
+ def self.fullscreen(window)
98
+ window.fullscreen = !window.fullscreen?
99
+ end
100
+
101
+ def self.resize(window, width, height, fullscreen)
102
+ window = GameWindow.new(width, height).show
103
+ window.fullscreen = fullscreen
104
+ end
105
+
106
+ def self.find_index_of_current_resolution width, height
107
+ current_index = nil
108
+ counter = 0
109
+ RESOLUTIONS.each do |resolution|
110
+ break if current_index && current_index > 0
111
+ current_index = counter if resolution[0] == width && resolution[1] == height
112
+ counter += 1
113
+ end
114
+ return current_index
115
+ end
116
+
117
+ def self.up_resolution(window)
118
+ # puts "UP RESLUTION"
119
+ index = find_index_of_current_resolution(window.width, window.height)
120
+ # puts "FOUND INDEX: #{index}"
121
+ if index == RESOLUTIONS.count - 1
122
+ # Max resolution, do nothing
123
+ else
124
+ # window.width = RESOLUTIONS[index + 1][0]
125
+ # window.height = RESOLUTIONS[index + 1][1]
126
+ width = RESOLUTIONS[index + 1][0]
127
+ height = RESOLUTIONS[index + 1][1]
128
+ # puts "UPPING TO #{width} x #{height}"
129
+ window = GameWindow.new(width, height, {block_resize: true}).show
130
+ end
131
+ end
132
+
133
+ def self.down_resolution(window)
134
+ index = find_index_of_current_resolution(window.width, window.height)
135
+ if index == 0
136
+ # Min resolution, do nothing
137
+ else
138
+ # window.width = RESOLUTIONS[index - 1][0]
139
+ # window.height = RESOLUTIONS[index - 1][1]
140
+ width = RESOLUTIONS[index - 1][0]
141
+ height = RESOLUTIONS[index - 1][1]
142
+ window = GameWindow.new(width, height, {block_resize: true}).show
143
+ end
144
+ end
145
+
146
+ def initialize width = nil, height = nil, options = {}
147
+ @block_all_controls = !options[:block_controls_until_button_up].nil? && options[:block_controls_until_button_up] == true ? true : false
148
+
149
+ @center_ui_y = 0
150
+ @center_ui_x = 0
151
+
152
+ @width = width || WIDTH
153
+ @height = height || HEIGHT
154
+
155
+ reset_center_font_ui_y
156
+
157
+ index = GameWindow.find_index_of_current_resolution(self.width, self.height)
158
+ if index == 0
159
+ @scale = 1
160
+ else
161
+ original_width, original_height = RESOLUTIONS[0]
162
+ width_scale = @width / original_width.to_f
163
+ height_scale = @height / original_height.to_f
164
+ @scale = (width_scale + height_scale) / 2
165
+ end
166
+ super(@width, @height)
167
+
168
+ @game_pause = false
169
+ @game_pause = false
170
+ @menu_open = false
171
+ @menu = nil
172
+ @can_open_menu = true
173
+ @can_pause = true
174
+ @can_resize = !options[:block_resize].nil? && options[:block_resize] == true ? false : true
175
+ @can_toggle_secondary = true
176
+ @can_toggle_fullscreen_a = true
177
+ @can_toggle_fullscreen_b = true
178
+
179
+ self.caption = "OpenGL Integration"
180
+
181
+ @gl_background = GLBackground.new
182
+
183
+ @player = Player.new(@scale, @width / 2, @height / 2)
184
+ @grappling_hook = nil
185
+
186
+ @buildings = Array.new
187
+ @projectiles = Array.new
188
+ @enemy_projectiles = Array.new
189
+ @pickups = Array.new
190
+
191
+ @enemies = Array.new
192
+ @enemies_random_spawn_timer = 100
193
+ @enemies_spawner_counter = 0
194
+
195
+ @font = Gosu::Font.new(20)
196
+ @max_enemies = 4
197
+
198
+ @pointer = Cursor.new(@scale)
199
+ @ui_y = 0
200
+ reset_font_ui_y
201
+ end
202
+
203
+ def button_up id
204
+ @block_all_controls = false
205
+ if (id == Gosu::MS_RIGHT) && @player.is_alive
206
+ @grappling_hook.deactivate if @grappling_hook
207
+ end
208
+
209
+ if (id == Gosu::KB_P)
210
+ @can_pause = true
211
+ end
212
+ if (id == Gosu::KB_TAB)
213
+ @can_toggle_secondary = true
214
+ end
215
+
216
+ if id == Gosu::KB_RETURN
217
+ @can_toggle_fullscreen_a = true
218
+ end
219
+ if id == Gosu::KB_RIGHT_META
220
+ @can_toggle_fullscreen_b = true
221
+ end
222
+ if id == Gosu::KB_MINUS
223
+ @can_resize = true
224
+ end
225
+ if id == Gosu::KB_EQUALS
226
+ @can_resize = true
227
+ end
228
+ end
229
+
230
+ def get_center_font_ui_y
231
+ return_value = @center_ui_y
232
+ @center_ui_y += 50
233
+ return return_value
234
+ end
235
+
236
+ def get_center_font_ui_x
237
+ return @center_ui_x
238
+ end
239
+
240
+ def reset_center_font_ui_y
241
+ @center_ui_y = @height / 2 - 100
242
+ @center_ui_x = @width / 2 - 100
243
+ end
244
+
245
+ def update
246
+ reset_center_font_ui_y
247
+ @menu.update if @menu
248
+ if !@block_all_controls
249
+ if Gosu.button_down?(Gosu::KbEscape) && @can_open_menu
250
+ @menu_open = true
251
+ @can_open_menu = false
252
+ @menu = Menu.new(self)
253
+ @menu.add_item(Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/exit.png", false), get_center_font_ui_x, get_center_font_ui_y, 1, lambda { self.close }, Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/exit_hover.png", false))
254
+ @menu.add_item(Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/resume.png", false), get_center_font_ui_x, get_center_font_ui_y, 1, lambda { @menu_open = false; @menu = nil; @can_open_menu = true; }, Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/resume.png", false))
255
+ # close!
256
+ end
257
+ if Gosu.button_down?(Gosu::KB_M)
258
+ GameWindow.reset(self)
259
+ end
260
+
261
+ if Gosu.button_down?(Gosu::KB_RIGHT_META) && Gosu.button_down?(Gosu::KB_RETURN) && @can_toggle_fullscreen_a && @can_toggle_fullscreen_b
262
+ @can_toggle_fullscreen_a = false
263
+ @can_toggle_fullscreen_b = false
264
+ GameWindow.fullscreen(self)
265
+ end
266
+
267
+
268
+ if Gosu.button_down?(Gosu::KB_P) && @can_pause
269
+ @can_pause = false
270
+ @game_pause = !@game_pause
271
+ end
272
+
273
+ if Gosu.button_down?(Gosu::KB_O) && @can_resize
274
+ @can_resize = false
275
+ GameWindow.resize(self, 1920, 1080, false)
276
+ end
277
+
278
+ if Gosu.button_down?(Gosu::KB_MINUS) && @can_resize
279
+ @can_resize = false
280
+ GameWindow.down_resolution(self)
281
+ end
282
+ if Gosu.button_down?(Gosu::KB_EQUALS) && @can_resize
283
+ @can_resize = false
284
+ GameWindow.up_resolution(self)
285
+ end
286
+
287
+
288
+ if Gosu.button_down?(Gosu::KB_TAB) && @can_toggle_secondary
289
+ @can_toggle_secondary = false
290
+ @player.toggle_secondary
291
+ end
292
+
293
+ if @player.is_alive && !@game_pause && !@menu_open
294
+ @player.update(@width, @height)
295
+ @player.move_left(@width) if Gosu.button_down?(Gosu::KB_LEFT) || Gosu.button_down?(Gosu::GP_LEFT) || Gosu.button_down?(Gosu::KB_A)
296
+ @player.move_right(@width) if Gosu.button_down?(Gosu::KB_RIGHT) || Gosu.button_down?(Gosu::GP_RIGHT) || Gosu.button_down?(Gosu::KB_D)
297
+ @player.accelerate(@height) if Gosu.button_down?(Gosu::KB_UP) || Gosu.button_down?(Gosu::GP_UP) || Gosu.button_down?(Gosu::KB_W)
298
+ @player.brake(@height) if Gosu.button_down?(Gosu::KB_DOWN) || Gosu.button_down?(Gosu::GP_DOWN) || Gosu.button_down?(Gosu::KB_S)
299
+
300
+ if Gosu.button_down?(Gosu::MS_RIGHT)
301
+ if @grappling_hook == nil
302
+ @grappling_hook = GrapplingHook.new(@scale, @player)
303
+ end
304
+ end
305
+
306
+ if Gosu.button_down?(Gosu::MS_LEFT)
307
+ @projectiles = @projectiles + @player.trigger_secondary_attack(@width, @height, self.mouse_x, self.mouse_y)
308
+ end
309
+
310
+ if Gosu.button_down?(Gosu::KB_SPACE)
311
+ if @player.cooldown_wait <= 0
312
+ results = @player.attack(@width, @height, self.mouse_x, self.mouse_y)
313
+ projectiles = results[:projectiles]
314
+ cooldown = results[:cooldown]
315
+ @player.cooldown_wait = cooldown.to_f.fdiv(@player.attack_speed)
316
+
317
+ projectiles.each do |projectile|
318
+ @projectiles.push(projectile)
319
+ end
320
+ end
321
+ end
322
+
323
+
324
+ @player.collect_pickups(@pickups)
325
+
326
+ @enemy_projectiles.each do |projectile|
327
+ projectile.hit_object(@player)
328
+ end
329
+
330
+
331
+ @grappling_hook.collect_pickups(@player, @pickups) if @grappling_hook && @grappling_hook.active
332
+ end
333
+
334
+ if !@game_pause && !@menu_open
335
+
336
+ @projectiles.each do |projectile|
337
+ results = projectile.hit_objects([@enemies, @buildings])
338
+ @pickups = @pickups + results[:drops]
339
+ @player.score += results[:point_value]
340
+ end
341
+
342
+
343
+
344
+
345
+ @buildings.reject! { |building| !building.update(@width, @height) }
346
+
347
+ if @player.is_alive && @grappling_hook
348
+ grap_result = @grappling_hook.update(@width, @height, self.mouse_x, self.mouse_y, @player)
349
+ @grappling_hook = nil if !grap_result
350
+ end
351
+
352
+ @pickups.reject! { |pickup| !pickup.update(@width, @height, self.mouse_x, self.mouse_y) }
353
+
354
+ @projectiles.reject! { |projectile| !projectile.update(@width, @height, self.mouse_x, self.mouse_y) }
355
+
356
+ @enemy_projectiles.reject! { |projectile| !projectile.update(@width, @height, self.mouse_x, self.mouse_y) }
357
+ @enemies.reject! { |enemy| !enemy.update(@width, @height, nil, nil, @player) }
358
+
359
+
360
+ @gl_background.scroll
361
+
362
+ @buildings.push(Building.new(@scale)) if rand(100) == 0
363
+
364
+
365
+ if @player.is_alive && rand(@enemies_random_spawn_timer) == 0 && @enemies.count <= @max_enemies
366
+ (0..@enemies_spawner_counter).each do |count|
367
+ @enemies.push(EnemyPlayer.new(@scale, @width, @height))
368
+ end
369
+ end
370
+ if @player.time_alive % 500 == 0
371
+ @max_enemies += 1
372
+ end
373
+ if @player.time_alive % 1000 == 0 && @enemies_random_spawn_timer > 5
374
+ @enemies_random_spawn_timer -= 5
375
+ end
376
+ if @player.time_alive % 5000 == 0
377
+ @enemies_spawner_counter += 1
378
+ end
379
+
380
+ if @player.time_alive % 1000 == 0 && @player.time_alive > 0
381
+ @player.score += 100
382
+ end
383
+
384
+
385
+ # Move to enemy mehtods
386
+ @enemies.each do |enemy|
387
+ enemy.cooldown_wait -= 1 if enemy.cooldown_wait > 0
388
+ if enemy.cooldown_wait <= 0
389
+ results = enemy.attack(@width, @height)
390
+ projectiles = results[:projectiles]
391
+ cooldown = results[:cooldown]
392
+ enemy.cooldown_wait = cooldown.to_f.fdiv(enemy.attack_speed)
393
+
394
+ projectiles.each do |projectile|
395
+ @enemy_projectiles.push(projectile)
396
+ end
397
+ end
398
+ end
399
+ end
400
+ end
401
+ end
402
+
403
+ def draw
404
+ @menu.draw if @menu
405
+ @pointer.draw(self.mouse_x, self.mouse_y) if @grappling_hook.nil? || !@grappling_hook.active
406
+
407
+ @player.draw() if @player.is_alive
408
+ @grappling_hook.draw(@player) if @player.is_alive && @grappling_hook
409
+ @font.draw("You are dead!", @width / 2 - 50, @height / 2 - 55, ZOrder::UI, 1.0, 1.0, 0xff_ffff00) if !@player.is_alive
410
+ @font.draw("Press ESC to quit", @width / 2 - 50, @height / 2 - 40, ZOrder::UI, 1.0, 1.0, 0xff_ffff00) if !@player.is_alive
411
+ @font.draw("Press M to Restart", @width / 2 - 50, @height / 2 - 25, ZOrder::UI, 1.0, 1.0, 0xff_ffff00) if !@player.is_alive
412
+ @font.draw("Paused", @width / 2 - 50, @height / 2 - 25, ZOrder::UI, 1.0, 1.0, 0xff_ffff00) if @game_pause
413
+ @enemies.each { |enemy| enemy.draw() }
414
+ @projectiles.each { |projectile| projectile.draw() }
415
+ @enemy_projectiles.each { |projectile| projectile.draw() }
416
+ # @stars.each { |star| star.draw }
417
+ @pickups.each { |pickup| pickup.draw() }
418
+ @buildings.each { |building| building.draw() }
419
+ @font.draw("Score: #{@player.score}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
420
+ # @font.draw("Attack Speed: #{@player.attack_speed.round(2)}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
421
+ @font.draw("Health: #{@player.health}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
422
+ @font.draw("Armor: #{@player.armor}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
423
+ # @font.draw("Rockets: #{@player.rockets}", 10, 70, ZOrder::UI, 1.0, 1.0, 0xff_ffff00) if @player.secondary_weapon == 'missile'
424
+ # @font.draw("Bombs: #{@player.bombs}", 10, 70, ZOrder::UI, 1.0, 1.0, 0xff_ffff00) if @player.secondary_weapon == 'bomb'
425
+ @font.draw("Weapon: #{@player.get_secondary_name}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
426
+ @font.draw("Rockets: #{@player.rockets}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
427
+ @font.draw("Bombs: #{@player.bombs}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00) if @player.bombs > 0
428
+ @font.draw("Time Alive: #{@player.time_alive}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
429
+ @font.draw("Level: #{@enemies_spawner_counter + 1}", 10, get_font_ui_y, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)
430
+ @gl_background.draw(ZOrder::Background)
431
+ reset_font_ui_y
432
+ end
433
+
434
+ def get_font_ui_y
435
+ return_value = @ui_y
436
+ @ui_y += 15
437
+ return return_value
438
+ end
439
+ def reset_font_ui_y
440
+ @ui_y = 10
441
+ end
442
+ end
443
+
444
+ GameWindow.new.show if __FILE__ == $0
@@ -0,0 +1,11 @@
1
+ # irb -r ./irb_requirements.rb
2
+
3
+ require 'rubygems'
4
+ require 'gosu'
5
+ require 'gl'
6
+ # require 'rmagick'
7
+ # require 'geometry'
8
+ # require_relative 'star.rb'
9
+ # require_relative 'bullet.rb'
10
+ # require_relative 'player.rb'
11
+ # require_relative 'enemy_player.rb'
@@ -0,0 +1,3 @@
1
+ module ZOrder
2
+ Background, Building, Cursor, Projectile, SmallExplosions, BigExplosions, Pickups, Enemy, Player, UI = *0..10
3
+ end
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
@@ -0,0 +1,25 @@
1
+ #....................................................#
2
+ #....................................................#
3
+ #.............xx......x.x............................#
4
+ #............x..x....................................#
5
+ #x....x...x..x.......#####..xxx....................x.#
6
+ #.x.........................xxx.........##.........x.#
7
+ #...............""..........###...##..........##.....#
8
+ #..##..###..##..##...................................#
9
+ #........................................xx........###
10
+ #.............................###....................#
11
+ ##....##.............................................#
12
+ #....................##....##......##....##....##....#
13
+ #.................................................x..#
14
+ #...x....##....##.......x...x.....................x..#
15
+ #.....x...............x...x...x...................x..#
16
+ #......x...##.....##.................................#
17
+ #.......x.........................................#..#
18
+ #...........##........#...#...#..#.......x...........#
19
+ #...#................................................#
20
+ #....."""".................x.......#..#####...###....#
21
+ #x....#......................##......................#
22
+ #"""""#.....#.....x..................#...............#
23
+ ##xxxx......#........................................#
24
+ ##xxxx...#####............."...""""".................#
25
+ ######"""#############################################
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
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" clip-rule="evenodd" stroke-miterlimit="10" viewBox="0 0 850.39 637.80">
3
+ <desc>SVG generated by Lineform</desc>
4
+ <defs/>
5
+ <g>
6
+ <rect width="940.00" height="734.00" x="-25.50" y="-55.50" fill="#5FB7FF" stroke="#000000" stroke-width="2.20"/>
7
+ <path d="M 223.50 49.00 C 171.16 49.00 118.84 59.51 78.91 80.50 C -0.96 122.48 -0.96 190.52 78.91 232.50 C 134.24 261.59 213.37 270.50 283.34 259.28 C 350.32 290.78 452.18 289.47 516.06 255.19 C 582.65 219.45 582.65 161.55 516.06 125.81 C 482.95 108.04 439.59 99.12 396.19 99.03 C 388.26 92.46 378.99 86.23 368.09 80.50 C 328.16 59.51 275.84 49.00 223.50 49.00 Z M 223.50 49.00 " fill="#FFFFFF" stroke="#BFBFBF" stroke-width="6.00"/>
8
+ <path d="M 735.48 183.00 C 699.52 183.00 663.55 187.05 636.11 195.16 C 607.54 203.59 593.99 214.76 595.17 225.81 C 561.74 227.76 529.60 233.37 503.83 242.72 C 438.71 266.35 438.71 304.65 503.83 328.28 C 568.96 351.91 674.56 351.91 739.69 328.28 C 787.65 310.88 800.17 285.50 777.48 263.91 C 798.41 261.97 818.28 258.74 834.86 253.84 C 889.73 237.64 889.73 211.36 834.86 195.16 C 807.42 187.05 771.44 183.00 735.48 183.00 Z M 735.48 183.00 " fill="#FFFFFF" stroke="#BFBFBF" stroke-width="6.00"/>
9
+ </g>
10
+ </svg>
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
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: line-em-up
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Ben Dana
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ocra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.10
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.10
27
+ - !ruby/object:Gem::Dependency
28
+ name: gosu
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.13.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.13.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: danabr75-opengl
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.10.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.10.0
55
+ description: A simple gosu test with a vertical-scrolling shooter
56
+ email: benrdana@gmail.com
57
+ executables:
58
+ - line-em-up.sh
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - bin/line-em-up.sh
63
+ - line-em-up/game_window.rb
64
+ - line-em-up/irb_requirements.rb
65
+ - line-em-up/lib/z_order.rb
66
+ - line-em-up/media/BrokenPNG.png
67
+ - line-em-up/media/Cursor.png
68
+ - line-em-up/media/JingleBells.mp3
69
+ - line-em-up/media/JingleBells.ogg
70
+ - line-em-up/media/Loop.wav
71
+ - line-em-up/media/Sample.wav
72
+ - line-em-up/media/SquareTexture.png
73
+ - line-em-up/media/Wallpaper.png
74
+ - line-em-up/media/WallpaperXXL.png
75
+ - line-em-up/media/WhiteAlpha.png
76
+ - line-em-up/media/additem.png
77
+ - line-em-up/media/additem_hover.png
78
+ - line-em-up/media/audio_formats/aiff_32bit_float.aiff
79
+ - line-em-up/media/audio_formats/au_16bit_pcm.au
80
+ - line-em-up/media/audio_formats/caf_be_16bit_44khz.caf
81
+ - line-em-up/media/audio_formats/caf_le_16bit_44khz.caf
82
+ - line-em-up/media/audio_formats/caf_le_8bit_44khz.caf
83
+ - line-em-up/media/audio_formats/general_midi.mid
84
+ - line-em-up/media/audio_formats/impulse_tracker.it
85
+ - line-em-up/media/audio_formats/mp3_128k_stereo.mp3
86
+ - line-em-up/media/audio_formats/mp3_avg_96kbit_jointstereo.mp3
87
+ - line-em-up/media/audio_formats/ogg_vorbis.ogg
88
+ - line-em-up/media/audio_formats/wav_16bit_pcm.wav
89
+ - line-em-up/media/audio_formats/wav_32bit_pcm.wav
90
+ - line-em-up/media/audio_formats/wav_4bit_ms_adpcm.wav
91
+ - line-em-up/media/back.png
92
+ - line-em-up/media/beep.wav
93
+ - line-em-up/media/bomb.png
94
+ - line-em-up/media/bomb_original.png
95
+ - line-em-up/media/bomb_pack.png
96
+ - line-em-up/media/building.png
97
+ - line-em-up/media/building_original.png
98
+ - line-em-up/media/bullet-mini-reverse.png
99
+ - line-em-up/media/bullet-mini.png
100
+ - line-em-up/media/bullet.png
101
+ - line-em-up/media/chain.png
102
+ - line-em-up/media/chain_original.png
103
+ - line-em-up/media/cptn_ruby.png
104
+ - line-em-up/media/cptn_ruby_map.txt
105
+ - line-em-up/media/crosshair.png
106
+ - line-em-up/media/cursor 2.png
107
+ - line-em-up/media/earth.png
108
+ - line-em-up/media/exit.png
109
+ - line-em-up/media/exit_hover.png
110
+ - line-em-up/media/explosion.wav
111
+ - line-em-up/media/gem.png
112
+ - line-em-up/media/grappling_hook.png
113
+ - line-em-up/media/grappling_hook_original.png
114
+ - line-em-up/media/header@2x.psd
115
+ - line-em-up/media/health_original.png
116
+ - line-em-up/media/health_pack_0.png
117
+ - line-em-up/media/health_pack_1.png
118
+ - line-em-up/media/health_pack_10.png
119
+ - line-em-up/media/health_pack_11.png
120
+ - line-em-up/media/health_pack_12.png
121
+ - line-em-up/media/health_pack_2.png
122
+ - line-em-up/media/health_pack_3.png
123
+ - line-em-up/media/health_pack_4.png
124
+ - line-em-up/media/health_pack_5.png
125
+ - line-em-up/media/health_pack_6.png
126
+ - line-em-up/media/health_pack_7.png
127
+ - line-em-up/media/health_pack_8.png
128
+ - line-em-up/media/health_pack_9.png
129
+ - line-em-up/media/image_formats/test.jpg
130
+ - line-em-up/media/image_formats/test.psd
131
+ - line-em-up/media/item.png
132
+ - line-em-up/media/item_hover.png
133
+ - line-em-up/media/landscape.svg
134
+ - line-em-up/media/large_star.png
135
+ - line-em-up/media/missile.png
136
+ - line-em-up/media/missile_original.png
137
+ - line-em-up/media/missile_pack.png
138
+ - line-em-up/media/missile_pack_original.png
139
+ - line-em-up/media/question.png
140
+ - line-em-up/media/question_original.png
141
+ - line-em-up/media/resume.png
142
+ - line-em-up/media/smoke.png
143
+ - line-em-up/media/soldier.png
144
+ - line-em-up/media/space.png
145
+ - line-em-up/media/spaceship.png
146
+ - line-em-up/media/spaceship_original.png
147
+ - line-em-up/media/star.png
148
+ - line-em-up/media/starfighter.bmp
149
+ - line-em-up/media/starfighterv2.bmp
150
+ - line-em-up/media/starfighterv4.png
151
+ - line-em-up/media/start.png
152
+ - line-em-up/media/tileset.png
153
+ - line-em-up/media/vera.ttf
154
+ homepage: https://github.com/danabr75/line-em-up
155
+ licenses:
156
+ - MIT
157
+ metadata: {}
158
+ post_install_message:
159
+ rdoc_options: []
160
+ require_paths:
161
+ - lib
162
+ required_ruby_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ required_rubygems_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ requirements: []
173
+ rubyforge_project:
174
+ rubygems_version: 2.4.8
175
+ signing_key:
176
+ specification_version: 4
177
+ summary: Vertical Scrolling Shooter
178
+ test_files: []