lotu 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.12
1
+ 0.1.13
@@ -57,8 +57,9 @@ class Cursors < Game
57
57
  # Setup some input handling for our Cursors app
58
58
  def setup_input
59
59
  set_keys(KbEscape => :close,
60
- KbD => [:debug!, false],
61
- KbT => [:toggle_text, false])
60
+ KbF1 => [:toggle_text, false],
61
+ KbF2 => [:debug!, false],
62
+ KbF3 => [:pause!, false])
62
63
  end
63
64
 
64
65
  # Now onto define some events
@@ -88,7 +89,11 @@ class Cursors < Game
88
89
  :width => 100,
89
90
  :rand_color => true,
90
91
  :mode => :additive)
91
- @cursor1.transform_angle(:init => 0, :end => 359, :duration => 10, :loop => true)
92
+ # Use the transformation system to change our angle over time,
93
+ # with an initial value of 0 degrees, to 359 degrees (full
94
+ # circle), do it in a time frame of 10 seconds, and when done,
95
+ # start over again
96
+ @cursor1.transform_angle(:init => 0, :end => 359, :duration => 10, :start_in => 3, :bounce => true, :loop => true)
92
97
 
93
98
  @cursor2 = Cursor.new(:image => 'crosshair-2.png',
94
99
  :use_mouse => false,
@@ -101,7 +106,11 @@ class Cursors < Game
101
106
  :width => 100,
102
107
  :rand_color => true,
103
108
  :mode => :additive)
104
- @cursor2.transform_angle(:init => 359, :end => 0, :duration => 1, :loop => true)
109
+ # Use the transformation system to change our angle over time,
110
+ # with an initial value of 359 degrees, to 0 degrees (full
111
+ # circle in reverse), do it in a time frame of 1 second, and
112
+ # when done, start over again
113
+ @cursor2.transform_angle(:init => 359, :end => 0, :duration => 1, :loop => true, :start_in => 2)
105
114
 
106
115
  # Center @cursor2 vertically and move it to the right 3/4 of the
107
116
  # screen
@@ -112,7 +121,7 @@ class Cursors < Game
112
121
  # call the to_s method on the objects it's watching
113
122
  # Create a TextBox with default option :size => 15
114
123
  @info = TextBox.new(:size => 15)
115
- @info.text("Press T to hide this text", :size => 24)
124
+ @info.text("Press F1 to hide this text", :size => 24)
116
125
  # Watch the FPS, so we get a nice FPS report on the screen
117
126
  @info.watch(@systems[FpsSystem], :size => 20)
118
127
  # Watch the Stalker system, so we know how many objects of the
@@ -50,8 +50,8 @@ class SteeringMissiles < Game
50
50
  def setup_input
51
51
  set_keys(KbEscape => :close,
52
52
  MsRight => :teleport_big_missile_to_midscreen,
53
- KbD => [:debug!, false],
54
- KbT => [:toggle_missile_info, false])
53
+ KbF2 => [:debug!, false],
54
+ KbF1 => [:toggle_missile_info, false])
55
55
  end
56
56
 
57
57
  def setup_systems
@@ -76,7 +76,7 @@ class SteeringMissiles < Game
76
76
  :rand_color => true)
77
77
 
78
78
  @window_info = TextBox.new(:size => 15)
79
- @window_info.text("Press T to hide this text", :size => 24)
79
+ @window_info.text("Press F1 to hide this text", :size => 24)
80
80
  @window_info.watch(@systems[FpsSystem], :size => 20)
81
81
  @window_info.watch(@systems[StalkerSystem], :color => 0xff33ccff)
82
82
  @window_info.watch(@cursor, :color => @cursor.color)
@@ -50,8 +50,8 @@ class EvadeMultiple < Game
50
50
  def setup_input
51
51
  set_keys(KbEscape => :close,
52
52
  MsRight => :teleport_big_missile_to_midscreen,
53
- KbD => [:debug!, false],
54
- KbT => [:toggle_info, false],
53
+ KbF2 => [:debug!, false],
54
+ KbF1 => [:toggle_info, false],
55
55
  KbSpace => [:pause!, false])
56
56
  end
57
57
 
@@ -80,7 +80,7 @@ class EvadeMultiple < Game
80
80
  :rand_color => true)
81
81
 
82
82
  @window_info = TextBox.new(:size => 15)
83
- @window_info.text("Press T to hide this text", :size => 24)
83
+ @window_info.text("Press F1 to hide this text", :size => 24)
84
84
  @window_info.watch(@systems[FpsSystem], :size => 20)
85
85
  @window_info.watch(@systems[StalkerSystem], :color => 0xff33ccff)
86
86
  @window_info.watch(@cursor, :color => @cursor.color)
@@ -15,12 +15,14 @@ module Lotu
15
15
  :property_setter => "#{property}=",
16
16
  :accum_time => 0,
17
17
  :calc => 0,
18
- :init => opts[:init],
19
- :end => opts[:end],
18
+ :init => Float(opts[:init]),
19
+ :end => Float(opts[:end]),
20
20
  :duration => opts[:duration] || 1,
21
21
  :start_in => opts[:start_in] || 0,
22
22
  :on_result => opts[:on_result],
23
- :loop => opts[:loop]
23
+ :loop => opts[:loop],
24
+ :bounce => opts[:bounce],
25
+ :bouncing_back => false
24
26
  }
25
27
  @transformations << transformation
26
28
  end
@@ -31,23 +33,17 @@ module Lotu
31
33
  if t[:accum_time] > t[:start_in]
32
34
  step = (t[:end] - t[:init])/t[:duration] * dt
33
35
  t[:calc] += step
34
- if step > 0
35
- if t[:init] + t[:calc] > t[:end]
36
- if t[:loop]
37
- t[:calc] = 0
38
- else
39
- t[:calc] = t[:end] - t[:init]
40
- tag_for_deletion(t)
41
- end
36
+ tag_for_deletion(t) if step == 0
37
+ if(t[:init] + t[:calc] > t[:end] && step > 0) || (t[:init] + t[:calc] < t[:end] && step < 0)
38
+ if t[:loop] || (t[:bounce] && !t[:bouncing_back])
39
+ t[:calc] = 0
40
+ else
41
+ t[:calc] = t[:end] - t[:init]
42
+ tag_for_deletion(t)
42
43
  end
43
- else
44
- if t[:init] + t[:calc] < t[:end]
45
- if t[:loop]
46
- t[:calc] = 0
47
- else
48
- t[:calc] = t[:end] - t[:init]
49
- tag_for_deletion(t)
50
- end
44
+ if t[:bounce]
45
+ t[:bouncing_back] = !t[:bouncing_back]
46
+ t[:init], t[:end] = t[:end], t[:init]
51
47
  end
52
48
  end
53
49
  value = t[:init] + t[:calc]
data/lotu.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{lotu}
8
- s.version = "0.1.12"
8
+ s.version = "0.1.13"
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{2010-03-28}
12
+ s.date = %q{2010-03-31}
13
13
  s.description = %q{lotu aims to bring an agile and simple game development framework to life. It provides useful abstractions so you can concentrate on developing your game.}
14
14
  s.email = %q{dev@lobotuerto.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 12
9
- version: 0.1.12
8
+ - 13
9
+ version: 0.1.13
10
10
  platform: ruby
11
11
  authors:
12
12
  - lobo_tuerto
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-28 00:00:00 -06:00
17
+ date: 2010-03-31 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency