gosu_extensions 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/gosu_extensions.rb +2 -2
- data/lib/traits/damaging.rb +2 -1
- data/lib/{units → traits}/moveable.rb +7 -5
- data/lib/{units → traits}/short_lived.rb +6 -2
- data/lib/units/thing.rb +4 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/gosu_extensions.rb
CHANGED
@@ -36,11 +36,11 @@ require 'shot'
|
|
36
36
|
require 'targetable'
|
37
37
|
require 'turnable'
|
38
38
|
require 'controllable'
|
39
|
+
require 'moveable'
|
40
|
+
require 'short_lived'
|
39
41
|
|
40
42
|
$:.unshift File.join(File.dirname(__FILE__), '/units')
|
41
43
|
require 'thing'
|
42
|
-
require 'moveable'
|
43
|
-
require 'short_lived'
|
44
44
|
|
45
45
|
require 'controls'
|
46
46
|
require 'game_window'
|
data/lib/traits/damaging.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# TODO moveable should only have active components, like accelerate etc. Positioning etc. should go to Thing.
|
4
4
|
#
|
5
|
-
|
5
|
+
module Moveable
|
6
6
|
|
7
7
|
Accelerate = :accelerate
|
8
8
|
Left = :move_left
|
@@ -12,7 +12,11 @@ class Moveable < Thing
|
|
12
12
|
Backwards = :backwards
|
13
13
|
# Jump = :jump
|
14
14
|
|
15
|
-
|
15
|
+
def self.included klass
|
16
|
+
klass.extend ClassMethods
|
17
|
+
end
|
18
|
+
|
19
|
+
module ClassMethods
|
16
20
|
|
17
21
|
# Initial setting.
|
18
22
|
#
|
@@ -76,9 +80,7 @@ class Moveable < Thing
|
|
76
80
|
@shape.body.v
|
77
81
|
end
|
78
82
|
def current_speed
|
79
|
-
|
80
|
-
#
|
81
|
-
Math.sqrt(speed.x**2 + speed.y**2)
|
83
|
+
speed.length
|
82
84
|
end
|
83
85
|
|
84
86
|
# Directly set the rotation of our Moveable.
|
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
module ShortLived
|
2
|
+
|
3
|
+
def self.included klass
|
4
|
+
klass.extend ClassMethods
|
5
|
+
end
|
2
6
|
|
3
7
|
def initialize window
|
4
8
|
super window
|
@@ -8,7 +12,7 @@ class ShortLived < Moveable
|
|
8
12
|
end
|
9
13
|
end
|
10
14
|
|
11
|
-
|
15
|
+
module ClassMethods
|
12
16
|
|
13
17
|
def lifetime lifetime = nil, &block
|
14
18
|
block = lambda { lifetime } unless block_given?
|
data/lib/units/thing.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Florian Hanke
|
@@ -75,8 +75,8 @@ files:
|
|
75
75
|
- lib/traits/targeting.rb
|
76
76
|
- lib/traits/targeting/closest.rb
|
77
77
|
- lib/traits/turnable.rb
|
78
|
-
- lib/
|
79
|
-
- lib/
|
78
|
+
- lib/traits/moveable.rb
|
79
|
+
- lib/traits/short_lived.rb
|
80
80
|
- lib/units/thing.rb
|
81
81
|
- lib/vector_utilities.rb
|
82
82
|
- lib/waves.rb
|