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 CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.7
@@ -283,7 +283,7 @@ class GameWindow < Gosu::Window
283
283
  # Main loop methods.
284
284
  #
285
285
 
286
- # TODO implement hooks.
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
@@ -1,13 +1,13 @@
1
- # TODO optimize
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
@@ -6,4 +6,10 @@ class Numeric
6
6
  CP::Vec2.new Math::cos(self), Math::sin(self)
7
7
  end
8
8
 
9
+ # Returns whether the number is close to the given one.
10
+ #
11
+ def close_to? number, e
12
+ self < (number+e) && self > (number-e)
13
+ end
14
+
9
15
  end
@@ -2,9 +2,6 @@
2
2
  #
3
3
  module Hitpoints extend Trait
4
4
 
5
- # TODO def revive!
6
- #
7
-
8
5
  # Prints an amount of information on these capabilities.
9
6
  #
10
7
  manual <<-MANUAL
data/lib/traits/lives.rb CHANGED
@@ -2,9 +2,6 @@
2
2
  #
3
3
  module Lives extend Trait
4
4
 
5
- # TODO def revive!
6
- #
7
-
8
5
  # Prints an amount of information on these capabilities.
9
6
  #
10
7
  manual <<-MANUAL
@@ -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
@@ -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> # TODO block
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
@@ -9,7 +9,7 @@ module Targeting
9
9
  # TODO fire arc
10
10
  #
11
11
  def acquire *targets
12
- targets.sort_by {|target| distance = (target.position - self.position).length }.first
12
+ targets.sort_by { |target| (target.position - self.position).length }.first
13
13
  end
14
14
  end
15
15
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 6
9
- version: 0.2.6
8
+ - 7
9
+ version: 0.2.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Florian Hanke