line-em-up 0.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/line-em-up/game_window.rb +189 -52
- data/line-em-up/irb_requirements.rb +24 -2
- data/line-em-up/lib/config_setting.rb +126 -16
- data/line-em-up/lib/difficulty_setting.rb +64 -64
- data/line-em-up/lib/lighting.rb +143 -0
- data/line-em-up/lib/resolution_setting.rb +58 -58
- data/line-em-up/lib/setting.rb +104 -0
- data/line-em-up/lib/ship_loadout_setting.rb +476 -0
- data/line-em-up/lib/ship_setting.rb +98 -0
- data/line-em-up/lib/z_order.rb +1 -1
- data/line-em-up/loadout_window.rb +253 -0
- data/line-em-up/media/bullet_launcher_hardpoint.png +0 -0
- data/line-em-up/media/hardpoint_empty.png +0 -0
- data/line-em-up/media/header@2x.psd +0 -0
- data/line-em-up/media/laser-end-background-half.png +0 -0
- data/line-em-up/media/laser-end-background.png +0 -0
- data/line-em-up/media/laser-end-overlay-half.png +0 -0
- data/line-em-up/media/laser-end-overlay.png +0 -0
- data/line-em-up/media/laser-middle-background-half.png +0 -0
- data/line-em-up/media/laser-middle-background.png +0 -0
- data/line-em-up/media/laser-middle-overlay-half.png +0 -0
- data/line-em-up/media/laser-middle-overlay-short.png +0 -0
- data/line-em-up/media/laser-middle-overlay.png +0 -0
- data/line-em-up/media/laser-overlay-half.png +0 -0
- data/line-em-up/media/laser-overlay.png +0 -0
- data/line-em-up/media/laser-start-background-half.png +0 -0
- data/line-em-up/media/laser-start-background.png +0 -0
- data/line-em-up/media/laser-start-overlay-half.png +0 -0
- data/line-em-up/media/laser-start-overlay.png +0 -0
- data/line-em-up/media/laser_beam_hardpoint copy.png +0 -0
- data/line-em-up/media/laser_beam_hardpoint.png +0 -0
- data/line-em-up/media/line-em-up-resolution.png +0 -0
- data/line-em-up/media/menu/loadout.png +0 -0
- data/line-em-up/media/{start.png → menu/start.png} +0 -0
- data/line-em-up/media/missile_launcher.png +0 -0
- data/line-em-up/media/{spaceship.png → pilotable_ships/basic_ship/default.png} +0 -0
- data/line-em-up/media/{spaceship_original.png → pilotable_ships/basic_ship/large.png} +0 -0
- data/line-em-up/media/{spaceship_left.png → pilotable_ships/basic_ship/left.png} +0 -0
- data/line-em-up/media/pilotable_ships/basic_ship/left_broadside.png +0 -0
- data/line-em-up/media/pilotable_ships/basic_ship/original.png +0 -0
- data/line-em-up/media/{spaceship_right.png → pilotable_ships/basic_ship/right.png} +0 -0
- data/line-em-up/media/pilotable_ships/basic_ship/right_broadside.png +0 -0
- data/line-em-up/media/pilotable_ships/mite_ship/default.png +0 -0
- data/line-em-up/media/pilotable_ships/mite_ship/large.png +0 -0
- data/line-em-up/media/pilotable_ships/mite_ship/left.png +0 -0
- data/line-em-up/media/pilotable_ships/mite_ship/left_broadside.png +0 -0
- data/line-em-up/media/pilotable_ships/mite_ship/original.png +0 -0
- data/line-em-up/media/pilotable_ships/mite_ship/right.png +0 -0
- data/line-em-up/media/pilotable_ships/mite_ship/right_broadside.png +0 -0
- data/line-em-up/media/pilotable_ships/mite_ship.zip +0 -0
- data/line-em-up/models/basic_ship.rb +94 -0
- data/line-em-up/models/bomb.rb +1 -1
- data/line-em-up/models/building.rb +2 -2
- data/line-em-up/models/bullet.rb +127 -74
- data/line-em-up/models/bullet_launcher.rb +23 -0
- data/line-em-up/models/cursor.rb +37 -1
- data/line-em-up/models/dumb_missile_launcher.rb +40 -0
- data/line-em-up/models/dumb_projectile.rb +9 -2
- data/line-em-up/models/enemy_bomb.rb +1 -1
- data/line-em-up/models/enemy_bullet.rb +55 -0
- data/line-em-up/models/enemy_player.rb +1 -1
- data/line-em-up/models/execute_open_gl.rb +80 -0
- data/line-em-up/models/general_object.rb +82 -9
- data/line-em-up/models/gl_background.rb +103 -30
- data/line-em-up/models/grappling_hook.rb +1 -1
- data/line-em-up/models/hardpoint.rb +120 -0
- data/line-em-up/models/laser_launcher.rb +192 -0
- data/line-em-up/models/laser_particle.rb +133 -0
- data/line-em-up/models/launcher.rb +149 -0
- data/line-em-up/models/main.rb +119 -26
- data/line-em-up/models/menu.rb +43 -3
- data/line-em-up/models/menu_item.rb +25 -14
- data/line-em-up/models/missile_boat.rb +5 -4
- data/line-em-up/models/mite.rb +3 -2
- data/line-em-up/models/mite_ship.rb +61 -0
- data/line-em-up/models/mothership.rb +1 -1
- data/line-em-up/models/pickup.rb +2 -2
- data/line-em-up/models/pilotable_ship.rb +599 -0
- data/line-em-up/models/player.rb +207 -150
- data/line-em-up/models/projectile.rb +3 -24
- data/line-em-up/models/semi_guided_missile.rb +1 -1
- data/line-em-up/models/small_explosion.rb +2 -2
- data/line-em-up/models/star.rb +7 -2
- data/menu_launcher.rb +10 -6
- metadata +113 -10
- data/line-em-up/media/spaceship_left-test.png +0 -0
@@ -0,0 +1,253 @@
|
|
1
|
+
require 'gosu'
|
2
|
+
require 'luit'
|
3
|
+
|
4
|
+
|
5
|
+
VENDOR_DIRECTORY = File.expand_path('../', __FILE__) + "/../vendors"
|
6
|
+
require "#{VENDOR_DIRECTORY}/lib/luit.rb"
|
7
|
+
CURRENT_DIRECTORY = File.expand_path('../', __FILE__)
|
8
|
+
MEDIA_DIRECTORY = File.expand_path('../', __FILE__) + "/media"
|
9
|
+
Dir["#{CURRENT_DIRECTORY}/lib/*.rb"].each { |f| require f }
|
10
|
+
Dir["#{CURRENT_DIRECTORY}/models/*.rb"].each { |f| require f }
|
11
|
+
require 'opengl'
|
12
|
+
|
13
|
+
class LoadoutWindow < Gosu::Window
|
14
|
+
require 'luit'
|
15
|
+
|
16
|
+
# CURRENT_DIRECTORY = File.expand_path('../', __FILE__)
|
17
|
+
MEDIA_DIRECTORY = File.expand_path('../', __FILE__) + "/media"
|
18
|
+
|
19
|
+
# CURRENT_DIRECTORY = File.expand_path('../', __FILE__)
|
20
|
+
puts "TEMP SAVE PATH: #{CURRENT_DIRECTORY}/../save.txt"
|
21
|
+
# SAVE_FILE = "#{CURRENT_DIRECTORY}/../save.txt"
|
22
|
+
CONFIG_FILE = "#{CURRENT_DIRECTORY}/../config.txt"
|
23
|
+
|
24
|
+
|
25
|
+
def self.start width = nil, height = nil, fullscreen = false, options = {}
|
26
|
+
# begin
|
27
|
+
# window = GameWindow.new.show
|
28
|
+
LoadoutWindow.new(width, height, fullscreen, options).show
|
29
|
+
# rescue Exception => e
|
30
|
+
# puts "Exception caught in GameWindow"
|
31
|
+
# puts e.message
|
32
|
+
# puts e.backtrace
|
33
|
+
# raise e
|
34
|
+
# end
|
35
|
+
end
|
36
|
+
|
37
|
+
attr_accessor :width, :height, :block_all_controls, :game_window
|
38
|
+
# attr_accessor :mouse_x, :mouse_y
|
39
|
+
def initialize width = nil, height = nil, fullscreen = false, options = {}
|
40
|
+
puts "INCOMING WIDHT AND HEIGHT: #{width} and #{height}"
|
41
|
+
@config_file_path = self.class::CONFIG_FILE
|
42
|
+
@cursor_object = nil
|
43
|
+
# @mouse_y = 0
|
44
|
+
# @mouse_x = 0
|
45
|
+
@window = self
|
46
|
+
@game_window = options[:game_window]
|
47
|
+
puts "NEW GAME WINDOW UIN LOADOUT"
|
48
|
+
puts @game_window
|
49
|
+
# @scale = 1
|
50
|
+
LUIT.config({window: @window, z: 25})
|
51
|
+
config_path = options[:config_path] || CONFIG_FILE
|
52
|
+
|
53
|
+
|
54
|
+
if width.nil? || height.nil?
|
55
|
+
# @width, @height = ResolutionSetting::SELECTION[0].split('x').collect{|s| s.to_i}
|
56
|
+
value = ConfigSetting.get_setting(@config_file_path, 'resolution', ResolutionSetting::SELECTION[0])
|
57
|
+
puts "RESOLUTION HERE: #{value}"
|
58
|
+
raise "DID NOT GET A RESOLUTION FROM CONFIG" if value.nil?
|
59
|
+
width, height = value.split('x')
|
60
|
+
@width, @height = [width.to_i, height.to_i]
|
61
|
+
else
|
62
|
+
puts 'USING INCOMING'
|
63
|
+
@width = width
|
64
|
+
@height = height
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
default_width, default_height = ResolutionSetting::SELECTION[0].split('x')
|
69
|
+
# default_width, default_height = default_value.split('x')
|
70
|
+
default_width, default_height = [default_width.to_i, default_height.to_i]
|
71
|
+
puts "DEFAULT WIDTH AND HIEGHT: #{default_width} - #{default_height}"
|
72
|
+
puts "DEFAULT WIDTH AND HIEGHT.to_f: #{default_width.to_f} - #{default_height.to_f}"
|
73
|
+
|
74
|
+
puts " WIDTH AND HIEGHT.: #{ @width} - #{@height}"
|
75
|
+
|
76
|
+
# Need to just pull from config file.. and then do scaling.
|
77
|
+
# index = GameWindow.find_index_of_current_resolution(self.width, self.height)
|
78
|
+
if @width == default_width && @height == default_height
|
79
|
+
@scale = 1
|
80
|
+
else
|
81
|
+
# original_width, original_height = RESOLUTIONS[0]
|
82
|
+
width_scale = @width / default_width.to_f
|
83
|
+
height_scale = @height / default_height.to_f
|
84
|
+
@scale = (width_scale + height_scale) / 2
|
85
|
+
end
|
86
|
+
puts "NEW SCALE: #{@scale}"
|
87
|
+
# super(@width, @height)
|
88
|
+
|
89
|
+
super(@width, @height, false)
|
90
|
+
@cursor = Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/cursor.png", false)
|
91
|
+
@gl_background = GLBackground.new
|
92
|
+
# x = self.width / 2 - 100
|
93
|
+
# y = self.height / 2 - 100
|
94
|
+
@center_ui_y = 0
|
95
|
+
@center_ui_x = 0
|
96
|
+
reset_center_font_ui_y
|
97
|
+
lineHeight = 50
|
98
|
+
@font = Gosu::Font.new(20)
|
99
|
+
self.caption = "A menu with Gosu"
|
100
|
+
# items = Array["exit", "additem", "item"]
|
101
|
+
# actions = Array[lambda { self.close }, lambda {
|
102
|
+
# @menu.add_item(Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/item.png", false), x, y, 1, lambda { })
|
103
|
+
# y += lineHeight
|
104
|
+
# }, lambda {}]
|
105
|
+
@menu = Menu.new(@window, @width, get_center_font_ui_y)
|
106
|
+
# for i in (0..items.size - 1)
|
107
|
+
# @menu.add_item(Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/#{items[i]}.png", false), x, y, 1, actions[i], Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/#{items[i]}_hover.png", false))
|
108
|
+
# y += lineHeight
|
109
|
+
# end
|
110
|
+
# exit_image = Gosu::Image.new("#{MEDIA_DIRECTORY}/exit.png")
|
111
|
+
# puts "WIDTH HERE: #{exit_image.width}"
|
112
|
+
# 8
|
113
|
+
# @menu.add_item(exit_image, ((@width / 2) - (exit_image.width / 2)), get_center_font_ui_y, 1, lambda { self.close }, exit_image)
|
114
|
+
fullscreen_window_height = Gosu.screen_height
|
115
|
+
# @resolution_menu = ResolutionSetting.new(@window, window_height, @width, @height, get_center_font_ui_y, config_path)
|
116
|
+
|
117
|
+
@difficulty = nil
|
118
|
+
@ship_menu = ShipSetting.new(@window, fullscreen_window_height, @width, @height, get_center_font_ui_y, config_path)
|
119
|
+
@ship_loadout_menu = ShipLoadoutSetting.new(@window, fullscreen_window_height, @width, @height, get_center_font_ui_y, config_path, @ship_menu.value, {scale: @scale})
|
120
|
+
increase_center_font_ui_y(@ship_loadout_menu.get_image.height + @ship_loadout_menu.get_large_image.height)
|
121
|
+
# puts "KLASS HERE : #{klass.get_image_assets_path(klass::SHIP_MEDIA_DIRECTORY)}"
|
122
|
+
|
123
|
+
# start_image = Gosu::Image.new("#{MEDIA_DIRECTORY}/menu/start.png")
|
124
|
+
@game_window_width, @game_window_height, @full_screen = [nil, nil, nil]
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
# debug_start_image = Gosu::Image.new("#{MEDIA_DIRECTORY}/debug_start.png")
|
129
|
+
# @menu.add_item(debug_start_image, (@width / 2) - (debug_start_image.width / 2), get_center_font_ui_y, ZOrder::UI, lambda {self.close; GameWindow.start(@game_window_width, @game_window_height, dynamic_get_resolution_fs, {block_controls_until_button_up: true, debug: true, difficulty: @difficulty}) }, debug_start_image)
|
130
|
+
|
131
|
+
# Increase y for padding
|
132
|
+
# get_center_font_ui_y
|
133
|
+
# increase_center_font_ui_y(@ship_menu.get_image.height)
|
134
|
+
|
135
|
+
# back_image = Gosu::Image.new("#{MEDIA_DIRECTORY}/back_to_menu.png")
|
136
|
+
# @menu.add_item(back_image, (@width / 2) - (back_image.width / 2), get_center_font_ui_y, ZOrder::UI, lambda { self.close; Main.new.show }, Gosu::Image.new(self, "#{MEDIA_DIRECTORY}/back_to_menu.png", false))
|
137
|
+
|
138
|
+
# @button_id_mapping = self.class.get_id_button_mapping
|
139
|
+
# @menu.add_item(start_image, (@width / 2) - (start_image.width / 2), get_center_font_ui_y, 1, lambda {self.close; GameWindow.start(@game_window_width, @game_window_height, dynamic_get_resolution_fs, {block_controls_until_button_up: true, difficulty: @difficulty}) }, start_image)
|
140
|
+
# loadout_image = Gosu::Image.new("#{MEDIA_DIRECTORY}/menu/loadout.png")
|
141
|
+
# @menu.add_item(loadout_image, (@width / 2) - (loadout_image.width / 2), get_center_font_ui_y, 1, lambda {self.close; LoadoutWindow.start() }, loadout_image)
|
142
|
+
# debug_start_image = Gosu::Image.new("#{MEDIA_DIRECTORY}/debug_start.png")
|
143
|
+
# @menu.add_item(debug_start_image, (@width / 2) - (debug_start_image.width / 2), get_center_font_ui_y, 1, lambda {self.close; GameWindow.start(@game_window_width, @game_window_height, dynamic_get_resolution_fs, {block_controls_until_button_up: true, debug: true, difficulty: @difficulty}) }, debug_start_image)
|
144
|
+
@button_id_mapping = self.class.get_id_button_mapping(self)
|
145
|
+
# @loadout_button = LUIT::Button.new(self, :loadout, (@width / 2), get_center_font_ui_y, "Back To Menu", 0, 1)
|
146
|
+
@back_button = LUIT::Button.new(self, :back, (@width / 2), @height, "Back", 0, 1)
|
147
|
+
end
|
148
|
+
|
149
|
+
def dynamic_get_resolution_fs
|
150
|
+
@fullscreen
|
151
|
+
end
|
152
|
+
|
153
|
+
def update
|
154
|
+
@cursor_object = nil
|
155
|
+
@menu.update
|
156
|
+
@ship_value = @ship_menu.update(self.mouse_x, self.mouse_y)
|
157
|
+
@cursor_object = @ship_loadout_menu.update(self.mouse_x, self.mouse_y, @ship_value)
|
158
|
+
|
159
|
+
# @loadout_button.update(-(@loadout_button.w / 2), -(@loadout_button.h))
|
160
|
+
@back_button.update(-(@back_button.w / 2), -(@back_button.h))
|
161
|
+
|
162
|
+
# @resolution_menu.update(self.mouse_x, self.mouse_y)
|
163
|
+
# @difficulty_menu.update(self.mouse_x, self.mouse_y)
|
164
|
+
|
165
|
+
# @game_window_width, @game_window_height, @fullscreen = @resolution_menu.get_resolution
|
166
|
+
# @difficulty = @difficulty_menu.get_difficulty
|
167
|
+
@gl_background.scroll
|
168
|
+
end
|
169
|
+
|
170
|
+
def draw
|
171
|
+
@cursor.draw(self.mouse_x, self.mouse_y, 100)
|
172
|
+
# puts "X and Y: #{self.mouse_x} and #{self.mouse_y}"
|
173
|
+
# @loadout_button.update(-(@loadout_button.w / 2), -(@loadout_button.h))
|
174
|
+
@back_button.draw(-(@back_button.w / 2), -(@back_button.h))
|
175
|
+
# @back.draw(0,0,0)
|
176
|
+
reset_center_font_ui_y
|
177
|
+
@menu.draw
|
178
|
+
@ship_menu.draw
|
179
|
+
@ship_loadout_menu.draw
|
180
|
+
# @resolution_menu.draw
|
181
|
+
# @difficulty_menu.draw
|
182
|
+
@gl_background.draw(ZOrder::Background)
|
183
|
+
end
|
184
|
+
|
185
|
+
def button_down id
|
186
|
+
if id == Gosu::MsLeft then
|
187
|
+
@menu.clicked
|
188
|
+
# @resolution_menu.clicked(self.mouse_x, self.mouse_y)
|
189
|
+
@ship_menu.clicked(self.mouse_x, self.mouse_y)
|
190
|
+
@ship_loadout_menu.clicked(self.mouse_x, self.mouse_y)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def increase_center_font_ui_y amount
|
195
|
+
@center_ui_y += amount
|
196
|
+
end
|
197
|
+
|
198
|
+
def get_center_font_ui_y
|
199
|
+
increase_center_font_ui_y(50)
|
200
|
+
end
|
201
|
+
|
202
|
+
def get_center_font_ui_x
|
203
|
+
return @center_ui_x
|
204
|
+
end
|
205
|
+
|
206
|
+
def reset_center_font_ui_y
|
207
|
+
@center_ui_y = -(self.height / 2) + self.height / 2
|
208
|
+
@center_ui_x = self.width / 2
|
209
|
+
end
|
210
|
+
|
211
|
+
def self.get_id_button_mapping(local_window)
|
212
|
+
{
|
213
|
+
# back: lambda { |window, id| window.close; Main.new.show }
|
214
|
+
back: lambda { |window, id|
|
215
|
+
# puts "SElocal_windowLF? #{local_window.class.name}"
|
216
|
+
# can't get it to bring the game window back
|
217
|
+
# self.close
|
218
|
+
# puts "curser"
|
219
|
+
# puts @cursor
|
220
|
+
# raise "STOP HERRE"
|
221
|
+
local_window.close
|
222
|
+
# puts "!!!!!!GAME wINDOW: #{window.game_window}"
|
223
|
+
if window.game_window
|
224
|
+
# window.game_window.show
|
225
|
+
GameWindow.new.show
|
226
|
+
else
|
227
|
+
Main.new.show
|
228
|
+
end
|
229
|
+
}
|
230
|
+
}
|
231
|
+
end
|
232
|
+
|
233
|
+
# required for LUIT objects, passes id of element
|
234
|
+
def onClick element_id
|
235
|
+
puts "LOADOUT WINDOW ONCLICK"
|
236
|
+
# Block any clicks unless curser object is nil
|
237
|
+
if !@cursor_object
|
238
|
+
button_clicked_exists = @button_id_mapping.key?(element_id)
|
239
|
+
if button_clicked_exists
|
240
|
+
@button_id_mapping[element_id].call(self, element_id)
|
241
|
+
else
|
242
|
+
puts "Clicked button that is not mapped: #{element_id}"
|
243
|
+
end
|
244
|
+
else
|
245
|
+
puts "CURSOR OBJECT WASNLT NIL"
|
246
|
+
puts @cursor_object
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
|
253
|
+
LoadoutWindow.new(nil,nil,nil,{game_window: nil}).show() if __FILE__ == $0
|
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
|
File without changes
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
Binary file
|
Binary file
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require_relative 'general_object.rb'
|
2
|
+
require_relative 'rocket_launcher_pickup.rb'
|
3
|
+
require_relative 'pilotable_ship.rb'
|
4
|
+
require 'gosu'
|
5
|
+
|
6
|
+
require 'opengl'
|
7
|
+
require 'glut'
|
8
|
+
|
9
|
+
|
10
|
+
include OpenGL
|
11
|
+
include GLUT
|
12
|
+
|
13
|
+
class BasicShip < PilotableShip
|
14
|
+
SHIP_MEDIA_DIRECTORY = "#{MEDIA_DIRECTORY}/pilotable_ships/basic_ship"
|
15
|
+
SPEED = 7
|
16
|
+
MAX_ATTACK_SPEED = 3.0
|
17
|
+
attr_accessor :cooldown_wait, :secondary_cooldown_wait, :attack_speed, :health, :armor, :x, :y, :rockets, :score, :time_alive
|
18
|
+
|
19
|
+
attr_accessor :bombs, :secondary_weapon, :grapple_hook_cooldown_wait, :damage_reduction, :boost_increase, :damage_increase, :kill_count
|
20
|
+
attr_accessor :special_attack, :main_weapon, :drawable_items_near_self, :broadside_mode, :front_hard_points, :broadside_hard_points
|
21
|
+
MAX_HEALTH = 200
|
22
|
+
|
23
|
+
FRONT_HARDPOINT_LOCATIONS = [
|
24
|
+
{
|
25
|
+
slot_type: :generic,
|
26
|
+
x_offset: lambda { |image, scale| ((image.width * scale) / 7) }, y_offset: lambda { |image, scale| -((image.height * scale) / 2.5) },
|
27
|
+
},
|
28
|
+
{
|
29
|
+
slot_type: :generic,
|
30
|
+
x_offset: lambda { |image, scale| -((image.width * scale) / 7) }, y_offset: lambda { |image, scale| -((image.height * scale) / 2.5) },
|
31
|
+
}
|
32
|
+
]
|
33
|
+
RIGHT_BROADSIDE_HARDPOINT_LOCATIONS = [
|
34
|
+
# Bottom One
|
35
|
+
{
|
36
|
+
slot_type: :generic,
|
37
|
+
x_offset: lambda { |image, scale| ((image.width * scale) / 7)}, y_offset: lambda { |image, scale| (image.height * scale) / 4 }
|
38
|
+
},
|
39
|
+
# Middle One
|
40
|
+
{
|
41
|
+
slot_type: :generic,
|
42
|
+
x_offset: lambda { |image, scale| ((image.width * scale) / 5)}, y_offset: lambda { |image, scale| 0 }
|
43
|
+
},
|
44
|
+
# Top One
|
45
|
+
{
|
46
|
+
slot_type: :generic,
|
47
|
+
x_offset: lambda { |image, scale| ((image.width * scale) / 6)}, y_offset: lambda { |image, scale| -((image.height * scale) / 4) }
|
48
|
+
}
|
49
|
+
# {y_offset: lambda { |image| 0 } , x_offset: lambda { |image| 0 } }
|
50
|
+
]
|
51
|
+
|
52
|
+
LEFT_BROADSIDE_HARDPOINT_LOCATIONS = [
|
53
|
+
# Bottom One
|
54
|
+
{
|
55
|
+
slot_type: :generic,
|
56
|
+
x_offset: lambda { |image, scale| -((image.width * scale) / 7)}, y_offset: lambda { |image, scale| -(image.height * scale) / 4 }
|
57
|
+
},
|
58
|
+
# Middle One
|
59
|
+
{
|
60
|
+
slot_type: :generic,
|
61
|
+
x_offset: lambda { |image, scale| -((image.width * scale) / 5)}, y_offset: lambda { |image, scale| 0 }
|
62
|
+
},
|
63
|
+
# Top One
|
64
|
+
{
|
65
|
+
slot_type: :generic,
|
66
|
+
x_offset: lambda { |image, scale| -((image.width * scale) / 6)}, y_offset: lambda { |image, scale| ((image.height * scale) / 4) }
|
67
|
+
}
|
68
|
+
# {y_offset: lambda { |image| 0 } , x_offset: lambda { |image| 0 } }
|
69
|
+
]
|
70
|
+
|
71
|
+
# Preserved, perfectly spaced
|
72
|
+
# RIGHT_BROADSIDE_HARDPOINT_LOCATIONS = [
|
73
|
+
# # Bottom One
|
74
|
+
# {
|
75
|
+
# x_offset: lambda { |image, scale| ((image.width * scale) / 2)}, y_offset: lambda { |image, scale| (image.height * scale) / 2 }
|
76
|
+
# },
|
77
|
+
# # Middle One
|
78
|
+
# {
|
79
|
+
# x_offset: lambda { |image, scale| ((image.width * scale) / 2)}, y_offset: lambda { |image, scale| 0 }
|
80
|
+
# },
|
81
|
+
# # Top One
|
82
|
+
# {
|
83
|
+
# x_offset: lambda { |image, scale| ((image.width * scale) / 2)}, y_offset: lambda { |image, scale| -((image.height * scale) / 2) }
|
84
|
+
# }
|
85
|
+
# # {y_offset: lambda { |image| 0 } , x_offset: lambda { |image| 0 } }
|
86
|
+
# ]
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
# Rocket Launcher, Rocket launcher, yannon, Cannon, Bomb Launcher
|
92
|
+
# FRONT_HARD_POINTS_MAX = 1
|
93
|
+
# BROADSIDE_HARD_POINTS = 3
|
94
|
+
end
|
data/line-em-up/models/bomb.rb
CHANGED
@@ -25,7 +25,7 @@ class Bomb < Projectile
|
|
25
25
|
end
|
26
26
|
|
27
27
|
|
28
|
-
def update mouse_x = nil, mouse_y = nil, player = nil
|
28
|
+
def update mouse_x = nil, mouse_y = nil, player = nil, scroll_factor = 1
|
29
29
|
vx = (self.class.get_starting_speed * @scale) * Math.cos(@angle * Math::PI / 180)
|
30
30
|
|
31
31
|
vy = (self.class.get_starting_speed * @scale) * Math.sin(@angle * Math::PI / 180)
|
@@ -55,9 +55,9 @@ class Building < GeneralObject
|
|
55
55
|
end
|
56
56
|
|
57
57
|
|
58
|
-
def update mouse_x = nil, mouse_y = nil, player = nil
|
58
|
+
def update mouse_x = nil, mouse_y = nil, player = nil, scroll_factor = 1
|
59
59
|
if is_alive
|
60
|
-
@y += @current_speed
|
60
|
+
@y += @current_speed * scroll_factor
|
61
61
|
@y < @screen_height + get_height
|
62
62
|
else
|
63
63
|
false
|