missile-command-ruby 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/cross_hair.rb +4 -16
- data/lib/enemy_command.rb +66 -0
- data/lib/enemy_explosion.rb +7 -0
- data/lib/enemy_missile.rb +17 -0
- data/lib/experimental.rb +26 -0
- data/lib/explosion.rb +9 -9
- data/lib/media/images/missile.png +0 -0
- data/lib/media/images/silo-b.png +0 -0
- data/lib/media/images/silo3.png +0 -0
- data/lib/media/songs/Amenoske-Overtura_Ce_en_Re_menor.mp3 +0 -0
- data/lib/missile-command-ruby.rb +85 -12
- data/lib/missile.rb +17 -20
- data/lib/player_explosion.rb +3 -0
- data/lib/player_missile.rb +13 -0
- data/lib/silo.rb +29 -29
- data/missile-command-ruby.gemspec +12 -2
- metadata +14 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
data/lib/cross_hair.rb
CHANGED
@@ -3,26 +3,14 @@ class CrossHair < Cursor
|
|
3
3
|
def initialize(opts={})
|
4
4
|
super
|
5
5
|
set_image 'crosshair-1.png', opts
|
6
|
-
@
|
7
|
-
|
6
|
+
@z = ZOrder::CrossHair
|
7
|
+
interpolate(self, :angle, :init => 0, :end => 359, :duration => 2, :loop => true)
|
8
|
+
interpolate(self, :factor, :init => 10, :end => 0.5, :duration => 3)
|
9
|
+
#interpolate(self, :factor_y, :init => 1, :end => 0.5, :duration => 0.6, :loop => true, :bounce => true)
|
8
10
|
end
|
9
11
|
|
10
12
|
def update
|
11
13
|
super
|
12
|
-
@angle += 10 * dt
|
13
|
-
return
|
14
|
-
if @bajando && @factor_y > 0.5
|
15
|
-
@factor_y -= dt
|
16
|
-
@factor_y = 0.5 if @factor_y < 0.5
|
17
|
-
else
|
18
|
-
@bajando = false
|
19
|
-
end
|
20
|
-
if !@bajando && @factor_y < 1.0
|
21
|
-
@factor_y += dt
|
22
|
-
@factor_y = 1.0 if @factor_y > 1.0
|
23
|
-
else
|
24
|
-
@bajando = true
|
25
|
-
end
|
26
14
|
end
|
27
15
|
|
28
16
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
class EnemyCommand < Actor
|
2
|
+
|
3
|
+
attr_accessor :attack_every
|
4
|
+
|
5
|
+
def initialize opts={}
|
6
|
+
super
|
7
|
+
@defeated = false
|
8
|
+
@stock = opts[:stock] || 10
|
9
|
+
@attack_every = opts[:attack_every] || 1
|
10
|
+
|
11
|
+
# Missiles configuration
|
12
|
+
@missile_conf = {
|
13
|
+
:width => opts[:missile_width] || 14,
|
14
|
+
:max_force => opts[:missile_max_force] || 10,
|
15
|
+
:max_speed => opts[:missile_max_speed] || 50,
|
16
|
+
:mass => opts[:missile_mass] || 1,
|
17
|
+
:color => opts[:missile_color] || 0xffccbcff
|
18
|
+
}
|
19
|
+
|
20
|
+
on :extra! do
|
21
|
+
unless Gosu::Song.current_song
|
22
|
+
$lotu.song('Amenoske-Overtura_Ce_en_Re_menor.mp3').play
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def attack! opts={}
|
28
|
+
unless @defeated
|
29
|
+
if @stock > 0
|
30
|
+
surprise = rand(5.0/@stock)
|
31
|
+
surprise *= 2 if opts[:extra]
|
32
|
+
@extra ||= {}
|
33
|
+
@extra[:max_speed] = 0
|
34
|
+
@extra[:color] = nil
|
35
|
+
if opts[:extra] == :speed
|
36
|
+
@extra[:max_speed] = @missile_conf[:max_speed] * 4
|
37
|
+
@extra[:color] = Gosu::Color.new(0xff000000)
|
38
|
+
@extra[:color].saturation = 0
|
39
|
+
end
|
40
|
+
missile = EnemyMissile.new(:mass => @missile_conf[:mass] + surprise,
|
41
|
+
:max_force => @missile_conf[:max_force] + surprise*10,
|
42
|
+
:max_speed => @missile_conf[:max_speed] + surprise*10 + @extra[:max_speed],
|
43
|
+
:color => @extra[:color] || @missile_conf[:color],
|
44
|
+
:x => rand($lotu.width),
|
45
|
+
:y => 0,
|
46
|
+
:angle => 180)
|
47
|
+
missile.save_init_pos
|
48
|
+
missile.target = Vector2d.new(rand($lotu.width), $lotu.height)
|
49
|
+
missile.play_animation('missile.png', :width => @missile_conf[:width] + surprise * 10)
|
50
|
+
if opts[:extra] == :speed
|
51
|
+
missile.interpolate_saturation( :init => 0.2, :end => 1, :duration => 1 )
|
52
|
+
missile.interpolate_value( :init => 1, :end => 0.2, :duration => 1, :bounce => true )
|
53
|
+
missile.interpolate_hue( :init => missile.color.hue, :end => missile.color.hue, :duration => 1, :loop => true)
|
54
|
+
end
|
55
|
+
@stock -= 1
|
56
|
+
else
|
57
|
+
@defeated = true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def to_s
|
63
|
+
"Stock: #{@stock}"
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class EnemyMissile < Missile
|
2
|
+
collides_as :enemy_missile
|
3
|
+
|
4
|
+
def initialize opts
|
5
|
+
super
|
6
|
+
@color.alpha = 0
|
7
|
+
interpolate_alpha(:init => 0, :end => 255, :duration => 2.5)
|
8
|
+
end
|
9
|
+
|
10
|
+
def die
|
11
|
+
super
|
12
|
+
EnemyExplosion.new(:x => @x, :y => @y, :color => @color, :mode => :additive,
|
13
|
+
:final_radius => @width*2.5,
|
14
|
+
:duration => @width/20,
|
15
|
+
:fade_after => (@width/20)*0.65)
|
16
|
+
end
|
17
|
+
end
|
data/lib/experimental.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Shape
|
2
|
+
class << self
|
3
|
+
attr_accessor :points
|
4
|
+
end
|
5
|
+
|
6
|
+
@points = { :missile => { :points => [[-1,0],[0,-2],[1,0]], :close => false },
|
7
|
+
:silo => { :points => [], :close => true } }
|
8
|
+
end
|
9
|
+
|
10
|
+
module Wireframe
|
11
|
+
def build_wireframe opts
|
12
|
+
scale = 5
|
13
|
+
@wireframe = opts[:points].cycle.each_cons(2).take(opts[:points].length)
|
14
|
+
@wireframe.map!{ |p1, p2| [Vector2d.new( p1[0] * scale, p1[1] * scale ), Vector2d.new( p2[0] * scale, p2[1] * scale )] }
|
15
|
+
@wireframe.pop unless opts[:close]
|
16
|
+
end
|
17
|
+
|
18
|
+
def draw
|
19
|
+
super
|
20
|
+
return
|
21
|
+
@wireframe.each do |v1, v2|
|
22
|
+
radians = @angle.degrees_to_radians
|
23
|
+
$lotu.draw_line(v1.rotate(radians).x + x, v1.rotate(radians).y + y, @color, v2.rotate(radians).x + x, v2.rotate(radians).y + y, @color)
|
24
|
+
end if @wireframe
|
25
|
+
end
|
26
|
+
end
|
data/lib/explosion.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
class Explosion < Actor
|
2
|
-
|
2
|
+
use_systems :interpolation
|
3
3
|
collides_as :explosion
|
4
4
|
|
5
5
|
def initialize(opts={})
|
6
6
|
super
|
7
7
|
set_image('explosion.png', opts)
|
8
|
-
@initial_radius = 10.0
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@fade_after =
|
8
|
+
@initial_radius = opts[:initial_radius] || 10.0
|
9
|
+
@final_radius = opts[:final_radius] || 100.0
|
10
|
+
@duration = opts[:duration] || 3.0
|
11
|
+
@fade_after = opts[:fade_after] || 2.5
|
12
12
|
|
13
|
-
interpolate_alpha(:init => 255, :end => 0, :duration => @
|
13
|
+
interpolate_alpha(:init => 255, :end => 0, :duration => @duration - @fade_after, :start_in => @fade_after)
|
14
14
|
interpolate_saturation(:init => 0.0, :end => 1.0, :duration => 0.1, :loop => true)
|
15
15
|
# Don't know why gosu changes my hue when only transforming
|
16
16
|
# saturation so we keep it fixed, or give it a little space for
|
@@ -19,16 +19,16 @@ class Explosion < Actor
|
|
19
19
|
|
20
20
|
self.radius = @initial_radius
|
21
21
|
# Expand or shrink the explosion
|
22
|
-
|
22
|
+
interpolate_my( :radius, :init => @initial_radius, :end => @final_radius, :duration => @duration )
|
23
23
|
|
24
|
-
@z =
|
24
|
+
@z = ZOrder::Explosion
|
25
25
|
@elapsed_time = 0.0
|
26
26
|
end
|
27
27
|
|
28
28
|
def update
|
29
29
|
# Note to self: It's important to call super!
|
30
30
|
super
|
31
|
-
if @elapsed_time > @
|
31
|
+
if @elapsed_time > @duration
|
32
32
|
die
|
33
33
|
end
|
34
34
|
@elapsed_time += dt
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/missile-command-ruby.rb
CHANGED
@@ -3,25 +3,86 @@ begin
|
|
3
3
|
rescue LoadError
|
4
4
|
end
|
5
5
|
|
6
|
+
module ZOrder
|
7
|
+
Background, Missile, Silo, Explosion, CrossHair = *0..4
|
8
|
+
end
|
9
|
+
|
6
10
|
require 'lotu'
|
7
11
|
include Lotu
|
8
12
|
|
9
13
|
require 'silo'
|
10
14
|
require 'explosion'
|
15
|
+
require 'enemy_explosion'
|
16
|
+
require 'player_explosion'
|
11
17
|
require 'missile'
|
18
|
+
require 'enemy_missile'
|
19
|
+
require 'player_missile'
|
12
20
|
require 'cross_hair'
|
21
|
+
# TODO: autorequire from ./actors?
|
22
|
+
require 'enemy_command'
|
23
|
+
|
24
|
+
class Background < Actor
|
25
|
+
use_systems :interpolation
|
26
|
+
|
27
|
+
attr_accessor :x1, :y1, :x2, :y2, :x3, :y3, :x4, :y4
|
28
|
+
|
29
|
+
def initialize opts
|
30
|
+
super
|
31
|
+
@z = ZOrder::Background
|
32
|
+
|
33
|
+
@y1 = opts[:init_y] || 0
|
34
|
+
@y2 = opts[:init_y] || 0
|
35
|
+
@y3 = opts[:end_y] || $lotu.height
|
36
|
+
@y4 = opts[:end_y] || $lotu.height
|
37
|
+
|
38
|
+
@x1 = opts[:init_x] || 0
|
39
|
+
@x2 = opts[:end_x] || $lotu.width
|
40
|
+
@x3 = opts[:end_x] || $lotu.width
|
41
|
+
@x4 = opts[:init_x] || 0
|
42
|
+
|
43
|
+
@c1 = opts[:init_color] || 0xff000000
|
44
|
+
@c2 = opts[:init_color] || 0xff000000
|
45
|
+
@c3 = opts[:end_color] || 0xff000000
|
46
|
+
@c4 = opts[:end_color] || 0xff000000
|
47
|
+
|
48
|
+
interpolate_my :y1, :init => @y1, :end => 700, :duration => 50, :loop => true, :bounce => true
|
49
|
+
interpolate_my :y2, :init => @y2, :end => 700, :duration => 50, :loop => true, :bounce => true
|
50
|
+
end
|
51
|
+
|
52
|
+
def draw
|
53
|
+
super
|
54
|
+
$lotu.draw_quad( @x1, @y1, @c1,
|
55
|
+
@x2, @y2, @c2,
|
56
|
+
@x3, @y3, @c3,
|
57
|
+
@x4, @y4, @c4,
|
58
|
+
ZOrder::Background, @mode)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
13
62
|
|
14
63
|
class MissileCommand < Game
|
15
|
-
|
16
|
-
#use StalkerSystem, :stalk => [Actor, Silo, Missile, Explosion, TextBox]
|
64
|
+
use_systems :collision#, :stalker => {:stalk => [Actor, Silo, Missile, Explosion, TextBox]}
|
17
65
|
|
18
66
|
def initialize
|
19
67
|
super
|
20
|
-
@
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
68
|
+
@acc_dt = 0
|
69
|
+
end
|
70
|
+
|
71
|
+
def update
|
72
|
+
super
|
73
|
+
@acc_dt += $lotu.dt
|
74
|
+
if @acc_dt > @enemy_command.attack_every
|
75
|
+
@enemy_command.attack!
|
76
|
+
@acc_dt = 0
|
77
|
+
if rand > 0.5
|
78
|
+
@enemy_command.attack!
|
79
|
+
end
|
80
|
+
if rand > 0.96
|
81
|
+
(rand(4)+2).times do
|
82
|
+
@enemy_command.attack! :extra => :speed
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
25
86
|
end
|
26
87
|
|
27
88
|
def load_resources
|
@@ -29,6 +90,7 @@ class MissileCommand < Game
|
|
29
90
|
load_images 'media/images'
|
30
91
|
load_sounds 'media/sounds'
|
31
92
|
load_animations 'media/animations'
|
93
|
+
load_songs 'media/songs'
|
32
94
|
end
|
33
95
|
end
|
34
96
|
|
@@ -40,23 +102,30 @@ class MissileCommand < Game
|
|
40
102
|
end
|
41
103
|
|
42
104
|
def setup_actors
|
105
|
+
@background = Background.new( :init_y => 500, :end_color => 0xff800080 )
|
106
|
+
@enemy_command = EnemyCommand.new( :stock => 50, :attack_every => 3 )
|
43
107
|
@player = Silo.new(:x => width/2,
|
44
108
|
:width => 100,
|
45
109
|
:stock => 10000,
|
46
|
-
:platform_capacity =>
|
47
|
-
:load_time => 0.
|
110
|
+
:platform_capacity => 5,
|
111
|
+
:load_time => 0.2,
|
48
112
|
:speed => 100,
|
49
113
|
:missile_speed => 1000,
|
50
114
|
:missile_force => 1000,
|
51
115
|
:missile_mass => 0.5)
|
52
|
-
@player.set_keys(Gosu::KbA => :move_left,
|
53
|
-
Gosu::KbD => :move_right)
|
54
116
|
|
55
117
|
@cross_hair = CrossHair.new(:keys => {Gosu::MsLeft => [:click, false], Gosu::MsRight => :click},
|
56
118
|
:rand_color => true,
|
57
119
|
:mode => :additive,
|
58
120
|
:width => 100)
|
59
121
|
|
122
|
+
@info = TextBox.new(:size => 15)
|
123
|
+
@info.text("Press F1 to hide this text | F2 debug info | F3 toggle pause", :size => 24)
|
124
|
+
@info.watch(lambda{ fps }, :size => 20)
|
125
|
+
@info.watch(@enemy_command)
|
126
|
+
#@info.watch(@systems[StalkerSystem], :color => 0xff33ccff)
|
127
|
+
@info.text("Click on screen to launch some missiles!")
|
128
|
+
|
60
129
|
@silo_info = TextBox.new(:attach_to => @player, :size => 14)
|
61
130
|
@silo_info.watch(@player)
|
62
131
|
end
|
@@ -66,9 +135,13 @@ class MissileCommand < Game
|
|
66
135
|
@player.launch_missile(x, y)
|
67
136
|
end
|
68
137
|
|
69
|
-
when_colliding(:explosion, :
|
138
|
+
when_colliding(:explosion, :enemy_missile) do |e, m|
|
70
139
|
m.die
|
71
140
|
end
|
141
|
+
|
142
|
+
when_colliding(:enemy_explosion, :silo) do |ex, s|
|
143
|
+
#s.die
|
144
|
+
end
|
72
145
|
end
|
73
146
|
|
74
147
|
def toggle_info
|
data/lib/missile.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
class Missile < Actor
|
3
|
-
use SteeringSystem
|
4
|
-
use AnimationSystem
|
5
2
|
|
3
|
+
class Missile < Actor
|
4
|
+
#include Wireframe
|
5
|
+
use_systems :steering, :animation, :interpolation
|
6
6
|
collides_as :missile
|
7
7
|
|
8
8
|
def initialize(opts={})
|
@@ -11,6 +11,18 @@ class Missile < Actor
|
|
11
11
|
@last_distance_to_target = nil
|
12
12
|
@target = nil
|
13
13
|
set_image('missile-med.png', opts)
|
14
|
+
@z = ZOrder::Missile
|
15
|
+
#build_wireframe Shape.points[:missile]
|
16
|
+
end
|
17
|
+
|
18
|
+
def save_init_pos
|
19
|
+
@init_x = x
|
20
|
+
@init_y = y
|
21
|
+
end
|
22
|
+
|
23
|
+
def align_to target
|
24
|
+
to_target = target - pos
|
25
|
+
self.heading = to_target.normalize!
|
14
26
|
end
|
15
27
|
|
16
28
|
def update
|
@@ -20,29 +32,14 @@ class Missile < Actor
|
|
20
32
|
if @target && (distance_to_target < 10 || !facing_target?)
|
21
33
|
die
|
22
34
|
end
|
23
|
-
return
|
24
|
-
if @bajando && @factor_y > 0.5
|
25
|
-
@factor_y -= dt
|
26
|
-
else
|
27
|
-
@bajando = false
|
28
|
-
end
|
29
|
-
if !@bajando && @factor_y < 1.0
|
30
|
-
@factor_y += dt
|
31
|
-
else
|
32
|
-
@bajando = true
|
33
|
-
end
|
34
35
|
end
|
35
36
|
|
36
37
|
def draw
|
37
38
|
super
|
38
39
|
color = @color.dup
|
39
40
|
color.saturation = color.value = 0.3
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
def die
|
44
|
-
super
|
45
|
-
Explosion.new(:x => @x, :y => @y, :color => @color, :mode => :additive)
|
41
|
+
#$lotu.draw_line(@pos.x, @pos.y, color, @target.x, @target.y, color) if @target
|
42
|
+
$lotu.draw_line(@pos.x, @pos.y, color, @init_x, @init_y, color) if @target
|
46
43
|
end
|
47
44
|
|
48
45
|
def collision_radius
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class PlayerMissile < Missile
|
2
|
+
collides_as :player_missile
|
3
|
+
|
4
|
+
def initialize opts
|
5
|
+
super
|
6
|
+
interpolate_alpha(:init => 0, :end => 255, :duration => 1, :on_stop => :complete)
|
7
|
+
end
|
8
|
+
|
9
|
+
def die
|
10
|
+
super
|
11
|
+
PlayerExplosion.new(:x => @x, :y => @y, :color => @color, :mode => :additive)
|
12
|
+
end
|
13
|
+
end
|
data/lib/silo.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
class Silo < Actor
|
2
|
+
collides_as :silo
|
2
3
|
attr_accessor :stock
|
3
4
|
|
4
5
|
def initialize(opts={})
|
5
6
|
super
|
6
|
-
set_image '
|
7
|
+
set_image 'silo-b.png', opts
|
7
8
|
@factor = @width / @image.width
|
8
9
|
@y = $lotu.height - @height/2
|
9
|
-
@z =
|
10
|
-
@speed = opts[:speed]
|
10
|
+
@z = ZOrder::Silo
|
11
11
|
|
12
12
|
@platform = []
|
13
13
|
# How many missiles in stock?
|
@@ -28,18 +28,22 @@ class Silo < Actor
|
|
28
28
|
@elapsed_time = -2
|
29
29
|
|
30
30
|
# Platform configuration in pixels
|
31
|
-
@
|
32
|
-
@
|
33
|
-
@
|
31
|
+
@left_padding = 13 * @factor
|
32
|
+
@right_padding = 24 * @factor
|
33
|
+
@bottom_padding = 18 * @factor
|
34
34
|
|
35
|
-
@missile_image_width =
|
35
|
+
@missile_image_width = 26
|
36
36
|
@missile_animation_width = @missile_image_width * 20 / 15
|
37
37
|
|
38
38
|
@slot_width = platform_width/@platform_capacity
|
39
39
|
end
|
40
40
|
|
41
|
+
def collision_radius
|
42
|
+
50
|
43
|
+
end
|
44
|
+
|
41
45
|
def platform_width
|
42
|
-
@width - @
|
46
|
+
@width - @left_padding - @right_padding
|
43
47
|
end
|
44
48
|
|
45
49
|
def update
|
@@ -60,18 +64,18 @@ class Silo < Actor
|
|
60
64
|
end
|
61
65
|
|
62
66
|
def new_missile
|
63
|
-
missile =
|
67
|
+
missile = PlayerMissile.new(:mass => @missile_conf[:mass],
|
64
68
|
:max_force => @missile_conf[:force],
|
65
69
|
:max_speed => @missile_conf[:speed],
|
66
|
-
:rand_color => true,
|
67
70
|
:width => @missile_image_width*@factor)
|
68
|
-
missile.
|
69
|
-
missile.
|
71
|
+
missile.x = initial_place(missile)
|
72
|
+
missile.y = @y + @height/2 - missile.height/2 - @bottom_padding
|
73
|
+
missile.interpolate(missile, :y, :init => missile.y+20, :end => missile.y, :duration => 0.5)
|
70
74
|
missile
|
71
75
|
end
|
72
76
|
|
73
77
|
def initial_place(missile)
|
74
|
-
res = @x - @width/2 + @
|
78
|
+
res = @x - @width/2 + @left_padding + missile.width/2 + (@platform_capacity - 1) * @slot_width
|
75
79
|
res += (@slot_width - missile.width)
|
76
80
|
res -= @elapsed_time / @load_time * @slot_width
|
77
81
|
res
|
@@ -79,35 +83,31 @@ class Silo < Actor
|
|
79
83
|
|
80
84
|
def place_missiles
|
81
85
|
@platform.each_with_index do |missile, i|
|
82
|
-
place_to_be = @x - @width/2 + @
|
86
|
+
place_to_be = @x - @width/2 + @left_padding + missile.width/2 + i * @slot_width
|
83
87
|
place_to_be += i/(@platform_capacity-1) * (@slot_width - missile.width)
|
84
|
-
if missile.
|
85
|
-
missile.
|
88
|
+
if missile.x > initial_place(missile)
|
89
|
+
missile.x = initial_place(missile)
|
86
90
|
end
|
87
|
-
if missile.
|
88
|
-
missile.
|
91
|
+
if missile.x > place_to_be
|
92
|
+
missile.x -= @slot_width * dt / @load_time
|
89
93
|
end
|
90
|
-
if missile.
|
91
|
-
missile.
|
94
|
+
if missile.x <= place_to_be
|
95
|
+
missile.x = place_to_be
|
92
96
|
end
|
93
97
|
end
|
94
98
|
end
|
95
99
|
|
96
100
|
def launch_missile(x, y)
|
97
101
|
if m = @platform.shift
|
98
|
-
m.
|
102
|
+
m.save_init_pos
|
103
|
+
m.stop_interpolations
|
104
|
+
target = Vector2d.new(x,y)
|
105
|
+
m.align_to target
|
106
|
+
m.target = target
|
99
107
|
m.play_animation('missile.png', :width => @missile_animation_width*@factor)
|
100
108
|
end
|
101
109
|
end
|
102
110
|
|
103
|
-
def move_left
|
104
|
-
@x -= @speed * dt
|
105
|
-
end
|
106
|
-
|
107
|
-
def move_right
|
108
|
-
@x += @speed * dt
|
109
|
-
end
|
110
|
-
|
111
111
|
def to_s
|
112
112
|
["@platform.length: #{@platform.length}",
|
113
113
|
"Missiles in stock: #{@stock}",
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{missile-command-ruby}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["lobo_tuerto"]
|
12
|
-
s.date = %q{2011-02-
|
12
|
+
s.date = %q{2011-02-27}
|
13
13
|
s.default_executable = %q{missile-command-ruby}
|
14
14
|
s.description = %q{Protect your cities, destroy the incoming enemy missiles!}
|
15
15
|
s.email = %q{dev@lobotuerto.com}
|
@@ -26,6 +26,10 @@ Gem::Specification.new do |s|
|
|
26
26
|
"VERSION",
|
27
27
|
"bin/missile-command-ruby",
|
28
28
|
"lib/cross_hair.rb",
|
29
|
+
"lib/enemy_command.rb",
|
30
|
+
"lib/enemy_explosion.rb",
|
31
|
+
"lib/enemy_missile.rb",
|
32
|
+
"lib/experimental.rb",
|
29
33
|
"lib/explosion.rb",
|
30
34
|
"lib/media/animations/missile.png",
|
31
35
|
"lib/media/animations/missile.txt",
|
@@ -45,11 +49,17 @@ Gem::Specification.new do |s|
|
|
45
49
|
"lib/media/images/explosion6.png",
|
46
50
|
"lib/media/images/lobo_tuerto.png",
|
47
51
|
"lib/media/images/missile-med.png",
|
52
|
+
"lib/media/images/missile.png",
|
53
|
+
"lib/media/images/silo-b.png",
|
48
54
|
"lib/media/images/silo.png",
|
49
55
|
"lib/media/images/silo2.png",
|
56
|
+
"lib/media/images/silo3.png",
|
57
|
+
"lib/media/songs/Amenoske-Overtura_Ce_en_Re_menor.mp3",
|
50
58
|
"lib/media/sounds/Explosion.wav",
|
51
59
|
"lib/missile-command-ruby.rb",
|
52
60
|
"lib/missile.rb",
|
61
|
+
"lib/player_explosion.rb",
|
62
|
+
"lib/player_missile.rb",
|
53
63
|
"lib/silo.rb",
|
54
64
|
"missile-command-ruby.gemspec"
|
55
65
|
]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: missile-command-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-02-
|
12
|
+
date: 2011-02-27 00:00:00.000000000 -06:00
|
13
13
|
default_executable: missile-command-ruby
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: lotu
|
17
|
-
requirement: &
|
17
|
+
requirement: &10065400 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *10065400
|
26
26
|
description: Protect your cities, destroy the incoming enemy missiles!
|
27
27
|
email: dev@lobotuerto.com
|
28
28
|
executables:
|
@@ -39,6 +39,10 @@ files:
|
|
39
39
|
- VERSION
|
40
40
|
- bin/missile-command-ruby
|
41
41
|
- lib/cross_hair.rb
|
42
|
+
- lib/enemy_command.rb
|
43
|
+
- lib/enemy_explosion.rb
|
44
|
+
- lib/enemy_missile.rb
|
45
|
+
- lib/experimental.rb
|
42
46
|
- lib/explosion.rb
|
43
47
|
- lib/media/animations/missile.png
|
44
48
|
- lib/media/animations/missile.txt
|
@@ -58,11 +62,17 @@ files:
|
|
58
62
|
- lib/media/images/explosion6.png
|
59
63
|
- lib/media/images/lobo_tuerto.png
|
60
64
|
- lib/media/images/missile-med.png
|
65
|
+
- lib/media/images/missile.png
|
66
|
+
- lib/media/images/silo-b.png
|
61
67
|
- lib/media/images/silo.png
|
62
68
|
- lib/media/images/silo2.png
|
69
|
+
- lib/media/images/silo3.png
|
70
|
+
- lib/media/songs/Amenoske-Overtura_Ce_en_Re_menor.mp3
|
63
71
|
- lib/media/sounds/Explosion.wav
|
64
72
|
- lib/missile-command-ruby.rb
|
65
73
|
- lib/missile.rb
|
74
|
+
- lib/player_explosion.rb
|
75
|
+
- lib/player_missile.rb
|
66
76
|
- lib/silo.rb
|
67
77
|
- missile-command-ruby.gemspec
|
68
78
|
has_rdoc: true
|