chingu_vectors 0.0.4

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/LICENSE +13 -0
  2. data/README +44 -0
  3. metadata +83 -0
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2012 Marvin Ede
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README ADDED
@@ -0,0 +1,44 @@
1
+ = chingu_vectors
2
+
3
+ Enables you to place and move your game objects via vectors.
4
+ Also speed and hastening are not declared as pixels per frame but in pixels per
5
+ second.
6
+
7
+ == Get it
8
+ You know how you get it:
9
+
10
+ gem install chingu_vectors
11
+
12
+ == Use it
13
+
14
+ After
15
+ require "chingu_vectors"
16
+ The trait <i>:vectors</i> is available:
17
+
18
+ class Player < Chingu::GameObject
19
+
20
+ trait :vectors
21
+
22
+ #This method will make the player move 20 pixes left per second
23
+ def move_left
24
+ self.speed = [0,-20]
25
+ end
26
+
27
+ end
28
+
29
+ == Another example
30
+ This would be a method that lets a ball follow another ball ("follow") nice and smoothly
31
+ def update
32
+ radiuses = size + follow.size
33
+ link = (follow.position - position)
34
+ if link.length < radiuses
35
+ self.speed = Vector::ZERO
36
+ else
37
+ link = link - link.normalize * radiuses # Connection between edges
38
+ self.speed = link * Game.speed
39
+ end
40
+ end
41
+
42
+ == Future planning
43
+ I have not been updating this gem all to terribly well. I will make sure to make it compatible with chingu 0.9 once
44
+ it comes out. I also may add some changes to the vector class.
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chingu_vectors
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Marvin Ede
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: chingu
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: A Chingu trait that handles game object movement via vectors. Speed and
47
+ hastening are in pixels per second instead of pixels per tick, so your games run
48
+ always with the same speed independed of the current framerate
49
+ email: marvinede@gmx.net
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files:
53
+ - README
54
+ - LICENSE
55
+ files:
56
+ - README
57
+ - LICENSE
58
+ homepage: https://rubygems.org/gems/chingu_vectors
59
+ licenses:
60
+ - apache 2.0
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 1.8.24
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: A Chingu trait that handles game object movement via vectors
83
+ test_files: []