chingu_vectors 1.0.2 → 1.1.0

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.
Files changed (3) hide show
  1. data/README +1 -0
  2. data/lib/actual_vectors.rb +14 -11
  3. metadata +2 -2
data/README CHANGED
@@ -40,6 +40,7 @@ This would be a method that lets a ball follow another ball ("follow") nice and
40
40
  end
41
41
 
42
42
  == Changelog
43
+ [1.1.0] * Fixed a problem where vectors would prevent other traits from executing update_trait
43
44
  [1.0.2] * Fixed problem with gemspec
44
45
  * Fixed Example a
45
46
  [1.0.0] * Vector no longer inherits from Array
@@ -2,13 +2,18 @@ module Chingu
2
2
  module Traits
3
3
  module Vectors
4
4
 
5
+ DEFAULT_OPTIONS = { :position => [0, 0],
6
+ :speed => [0, 0],
7
+ :hastening => [0, 0] }
8
+
5
9
  module ClassMethods
6
10
  #
7
11
  # Initializes trait with no costum options
8
12
  #
9
- def initialize_trait(options = { })
10
- trait_options[:vectors] = { apply: true, debug: false }.merge(options)
11
- end
13
+ #def initialize_trait(options = { })
14
+ # trait_options[:vectors] = { apply: true, debug: false }.merge(options)
15
+ # super options
16
+ #end
12
17
  end
13
18
 
14
19
  #
@@ -25,19 +30,17 @@ module Chingu
25
30
  # Position of game object in last tick
26
31
  attr_reader :last_position
27
32
 
28
-
29
33
  #
30
34
  # Sets up the trait. Possible options are position, speed and hastening
31
35
  # (with defaults [0,0] respectively) <br>
32
36
  #
33
37
  def setup_trait options
34
- vectors_options = { :position => [0, 0],
35
- :speed => [0, 0],
36
- :hastening => [0, 0] }.merge(options)
37
- self.position = vectors_options[:position]
38
- self.speed = vectors_options[:speed]
39
- self.hastening = vectors_options[:hastening]
40
- #super
38
+ puts "setup trait in vectors called"
39
+ trait_options[:vectors] = DEFAULT_OPTIONS.merge(options)
40
+ self.position = trait_options[:vectors][:position]
41
+ self.speed = trait_options[:vectors][:speed]
42
+ self.hastening = trait_options[:vectors][:hastening]
43
+ super options
41
44
  end
42
45
 
43
46
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chingu_vectors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-08 00:00:00.000000000 Z
12
+ date: 2012-07-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chingu