metro-ld26 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTU1OTI4NDhhNmM2NmFkZDM2YjJlMGJhMjhmMmIxMmZiMmVlODczNA==
4
+ MWM3NGYwOGRlMWEyYWQ0YmIzMTg2ZDBjOTc5Zjg2MTE0MTQwM2Q2ZA==
5
5
  data.tar.gz: !binary |-
6
- YWVmMzRkYTNmYzIxM2YwNmI0MTBlNTc2MWVlNGY3MTU4ZjQyYTU0Ng==
6
+ ZDRiYzMwYzExZmVjNDRmNmNkZTQ5ZjRjM2VkYTA1NzBkZjA0NmM1OA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- M2VmMWMyNGM4ZWM4NTBlNDFkYTM1NzQ2MTcwYjg5NTZmMmE1YWJjNDdkMjcz
10
- MzAxN2NiZGUzMDQxNDk5NGEzOTdmOTAzOTY2NDI0MjA2ZTI4YmNmODgzZDM2
11
- MDU4NzQzMWM1Mjk0MTdhNWYxY2FiOWVjNzg1ODkwNGViM2JjOGE=
9
+ MzA3ODExZmVmNWFjMTA4MTczNGFmMWZiNDkxOWJkZTc1NmFkYzg2OWI3MzQ3
10
+ MGNiN2NhOWY5ZDhjODE5ZTlhMGVjZWY2NTFiMzUwNzI2YjZlNzExZTcwMWY0
11
+ ZmI5NjZkNGI5NjdhNWRkNjNlODI2OGRjMjEwMWFmNmM0YTEyYWE=
12
12
  data.tar.gz: !binary |-
13
- NjM0N2FiYmU3YTI4NTA1MmM2NGEzZmEyMDA3NjBkZjBkYjlmMTcyNTcyZWIy
14
- ZmNmMDJiYmNlNzVmMDRjYjUzYjQ5Zjk3MDg5NzFlZmQyZmUwYmVkMDlkY2E0
15
- Zjk3Mjc4ODY2ZjE5NTdkZGJhYWMzODQ5MGVmMGZhMzY4NTRkNzc=
13
+ Yzk5ODBjM2ZiNmI1MjExNzM1NmY5MzBkNDc2MDNjNjY0ZGFjYTBjYWVlYjgw
14
+ ZmFkZmQyZWEzYzAyYjNlOWQzNDY0Y2UyNGRiNzU2OGEzZjBkZDE4MDc0NTA2
15
+ ODNkYjAwYjYzYjMzOTUxZjA3YmU2MmYzYmFkOTkxYWYxMzU3ODQ=
@@ -21,7 +21,6 @@ require 'gosu_ext/color'
21
21
  require 'gosu_ext/gosu_constants'
22
22
  require 'tmx_ext/tile_set'
23
23
  require 'tmx_ext/object'
24
- require 'tmx_ext/object_shape'
25
24
 
26
25
  require 'locale/locale'
27
26
 
@@ -1,8 +1,8 @@
1
1
  module Metro
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  WEBSITE = "https://github.com/burtlo/metro"
4
4
  CONTACT_EMAILS = ["dev@rubymetro.com"]
5
-
5
+
6
6
  def self.changes_for_version(version)
7
7
 
8
8
  change = Struct::Changes.new(nil,[])
@@ -28,5 +28,5 @@ module Metro
28
28
 
29
29
  change
30
30
  end
31
-
31
+
32
32
  end
@@ -8,9 +8,37 @@ module Tmx
8
8
  end
9
9
 
10
10
  def shape
11
- @shape ||= Tmx::ObjectShape.create_from_tmx_object(self)
11
+ @poly_shape ||= begin
12
+ new_shape = CP::Shape::Poly.new(body,poly_vec2s,default_shape_attach_point)
13
+ new_shape.collision_type = type.to_sym
14
+ new_shape.e = default_elasticity
15
+ new_shape.sensor = default_sensor
16
+ new_shape
17
+ end
12
18
  end
13
19
 
20
+ private
21
+
22
+ #
23
+ # A TMX object currently has an array of points in a format
24
+ # list of strings. This will convert the points into
25
+ # list of CP::Vec2 objects which can be used to create the
26
+ # proper CP::Shape::Poly for the Object.
27
+ #
28
+ # @note this assumes that we want to convert the points into
29
+ # a format of vec2s specifically for a CP::Shape::Poly
30
+ # shape.
31
+ #
32
+ def poly_vec2s
33
+ points.map do |point|
34
+ x,y = point.split(",").map {|p| p.to_i }
35
+ CP::Vec2.new(x,y)
36
+ end.reverse
37
+ end
38
+
39
+ def default_sensor
40
+ false
41
+ end
14
42
 
15
43
  def default_mass
16
44
  Float::INFINITY
@@ -20,6 +48,13 @@ module Tmx
20
48
  Float::INFINITY
21
49
  end
22
50
 
51
+ def default_elasticity
52
+ 0.0
53
+ end
54
+
55
+ def default_shape_attach_point
56
+ CP::Vec2::ZERO
57
+ end
23
58
 
24
59
  end
25
60
 
@@ -1,14 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Tmx::Object do
4
- context "when created with a polygon" do
4
+ context "when created with standard parameters" do
5
5
 
6
6
  let(:object) do
7
- Tmx::Object.new contents.merge(contents: contents)
8
- end
9
-
10
- let(:contents) do
11
- { 'points' => points, 'type' => "rock", 'shape' => "polygon" }
7
+ Tmx::Object.new points: points, type: "rock"
12
8
  end
13
9
 
14
10
  #
@@ -50,47 +46,4 @@ describe Tmx::Object do
50
46
  end
51
47
  end
52
48
 
53
- context "when created with a ellipse" do
54
-
55
- let(:object) do
56
- Tmx::Object.new contents.merge(contents: contents)
57
- end
58
-
59
- let(:contents) do
60
- { 'type' => "mushroom", 'shape' => "ellipse", 'x' => 256, 'y' => 224, 'width' => 32, 'height' => 32 }
61
- end
62
-
63
- describe "#body" do
64
- let(:body) { object.body }
65
-
66
- it "has infinite mass" do
67
- expect(body.m).to eq Float::INFINITY
68
- end
69
-
70
- it "has infinite moment of interia" do
71
- expect(body.i).to eq Float::INFINITY
72
- end
73
- end
74
-
75
- describe "#shape" do
76
- let(:shape) { object.shape }
77
-
78
- it "body should be the same body" do
79
- expect(shape.body).to eq object.body
80
- end
81
-
82
- it "has correct collision type" do
83
- expect(shape.collision_type).to eq :mushroom
84
- end
85
-
86
- it "not a sensor" do
87
- expect(shape).to_not be_sensor
88
- end
89
-
90
- it "has no elasticity" do
91
- expect(shape.e).to eq 0.0
92
- end
93
- end
94
- end
95
-
96
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metro-ld26
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franklin Webber
@@ -322,11 +322,8 @@ metadata: {}
322
322
  post_install_message: ! " ______ ___ _____\n ___ |/ /_____ __ /_______________\n
323
323
  \ __ /|_/ / _ _ \\_ __/__ ___/_ __ \\\n _ / / / / __// /_ _ / /
324
324
  /_/ /\n /_/ /_/ \\___/ \\__/ /_/ \\____/\n\n Thank you for installing
325
- metro 0.3.4 / 2012-12-14.\n ---------------------------------------------------------------------\n
326
- \ Changes:\n \n * `metro::ui::sprite` and `metro::ui::animated_sprite` model
327
- classes\n to make it easier to take care of all the basic model attributes.\n
328
- \ * Event Management changed in the background. The API remains the\n same.\n
329
- \ \n\n ---------------------------------------------------------------------\n"
325
+ metro 0.3.5 / .\n ---------------------------------------------------------------------\n
326
+ \ Changes:\n \n ---------------------------------------------------------------------\n"
330
327
  rdoc_options: []
331
328
  require_paths:
332
329
  - lib