gosu_extensions 0.2.6 → 0.2.7
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.
- data/VERSION +1 -1
- data/lib/core/game_window.rb +1 -2
- data/lib/core/moveables.rb +3 -3
- data/lib/extensions/numeric.rb +6 -0
- data/lib/traits/hitpoints.rb +0 -3
- data/lib/traits/lives.rb +0 -3
- data/lib/traits/moveable.rb +2 -3
- data/lib/traits/shooter.rb +3 -1
- data/lib/traits/targeting/closest.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.7
|
data/lib/core/game_window.rb
CHANGED
@@ -283,7 +283,7 @@ class GameWindow < Gosu::Window
|
|
283
283
|
# Main loop methods.
|
284
284
|
#
|
285
285
|
|
286
|
-
#
|
286
|
+
#
|
287
287
|
#
|
288
288
|
def update
|
289
289
|
@current_loop.call
|
@@ -293,7 +293,6 @@ class GameWindow < Gosu::Window
|
|
293
293
|
proceed if proceed_condition && instance_eval(&proceed_condition)
|
294
294
|
advance_step
|
295
295
|
handle_input
|
296
|
-
# TODO stopped
|
297
296
|
end
|
298
297
|
after_stopping
|
299
298
|
end
|
data/lib/core/moveables.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# Holds the moveables that are moved and drawn.
|
2
2
|
#
|
3
3
|
class Moveables
|
4
4
|
|
5
|
+
delegate :each, :to => :@elements
|
6
|
+
|
5
7
|
def initialize elements = []
|
6
8
|
@elements = elements
|
7
9
|
end
|
8
10
|
|
9
|
-
delegate :each, :to => :@elements
|
10
|
-
|
11
11
|
def register moveable
|
12
12
|
@elements << moveable
|
13
13
|
end
|
data/lib/extensions/numeric.rb
CHANGED
data/lib/traits/hitpoints.rb
CHANGED
data/lib/traits/lives.rb
CHANGED
data/lib/traits/moveable.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# A moveable has a shape, speed etc.
|
2
2
|
#
|
3
|
-
# TODO moveable should only have active components, like accelerate etc. Positioning etc. should go to Thing.
|
4
|
-
#
|
5
3
|
module Moveable extend Trait
|
6
4
|
|
7
5
|
Accelerate = :accelerate; def self.accelerate strength = 1.0; [Accelerate, strength] end
|
@@ -10,7 +8,6 @@ module Moveable extend Trait
|
|
10
8
|
Up = :move_up; def self.up strength = 1.0; [Up, strength] end
|
11
9
|
Down = :move_down; def self.down strength = 1.0; [Down, strength] end
|
12
10
|
Backwards = :backwards; def self.backwards strength = 1.0; [Backwards, strength] end
|
13
|
-
# TODO Jump = :jump
|
14
11
|
|
15
12
|
# Default methods for controls.
|
16
13
|
#
|
@@ -35,6 +32,8 @@ module Moveable extend Trait
|
|
35
32
|
|
36
33
|
# Movement rules
|
37
34
|
#
|
35
|
+
# TODO Move to Sprite?
|
36
|
+
#
|
38
37
|
# Note: Call in method move.
|
39
38
|
#
|
40
39
|
def bounce_off_border_x elasticity = 1.0
|
data/lib/traits/shooter.rb
CHANGED
@@ -5,7 +5,7 @@ module Shooter extend Trait
|
|
5
5
|
manual <<-MANUAL
|
6
6
|
Defines:
|
7
7
|
range <some range> # This is only needed for targeted shooting, e.g. automatic cannons
|
8
|
-
frequency <some shooting frequency>
|
8
|
+
frequency <some shooting frequency>
|
9
9
|
shoots <class:thing>
|
10
10
|
muzzle_position { position calculation } || frontal # a block
|
11
11
|
muzzle_velocity { velocity calculation }
|
@@ -39,6 +39,8 @@ module Shooter extend Trait
|
|
39
39
|
self.shooting_range = amount
|
40
40
|
end
|
41
41
|
end
|
42
|
+
# TODO block
|
43
|
+
#
|
42
44
|
def frequency amount
|
43
45
|
InitializerHooks.register self do
|
44
46
|
self.shooting_rate = ((SUBSTEPS**2).to_f/amount)/2
|