dedalus 0.2.11 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69c2e241081316b40a5202ef1e04a8ffb891eec1
4
- data.tar.gz: 10d5a9974a8ba9ea0d8be625b4e963f4892272a2
3
+ metadata.gz: ccd682d80ad90e1cf10020d057c1d58ec41e7b63
4
+ data.tar.gz: 8795a8e23edaee430a5299675a49719c56bc8749
5
5
  SHA512:
6
- metadata.gz: d5e4ba3c3d4b5489228cdff7b7e1a1a09fa9a734b012361a5503e1b75a5c7f484f2b4c4599fd9748fe4086eacf28c6df5f659d45c670435295ba1990e6f75ad0
7
- data.tar.gz: 1990bd8db8a9d23feb6fdaf0d28bbd8ccdb32409b5ab5f28a309488069ee3518d9634316d3885fb6100284fbe4090dee5bda9f053abe228315015dc3ea6ea8c8
6
+ metadata.gz: 6af7458172873ddc245a291d2bcbee55dda5a157113915f8c0af9009ab0000d63f3ad4dd1de2cc9f6a30dcc9c2b6b6cfddf1a319058dcaca7a80a8ad6b674ee7
7
+ data.tar.gz: 05d2f7bac3b56a1912e035d76eebd13b4dbcb6c671bd035abb4bd116541da79371d7d6b2247c6d7d4927bf16f7e8f253a377001ec2db952d6cda8fa8f0e72d86
@@ -2,11 +2,21 @@ module Dedalus
2
2
  module Elements
3
3
  class SpriteField < Dedalus::Organism
4
4
  attr_accessor :grid, :sprite_map, :scale, :camera_location
5
+ # TODO tiles path and width/height as attrs
5
6
 
6
7
  def show
7
8
  layers
8
9
  end
9
10
 
11
+ def camera_offset
12
+ if camera_location
13
+ cx,cy = *camera_location
14
+ [-cx * 64, -cy * 64]
15
+ else
16
+ [0,0]
17
+ end
18
+ end
19
+
10
20
  def layers
11
21
  layer_stack = Dedalus::LayerStack.new
12
22
  layer_stack.push(Dedalus::Layer.new(background_image))
@@ -31,20 +41,20 @@ module Dedalus
31
41
  end
32
42
 
33
43
  def image_grid
34
- cx,cy = *camera_location
44
+ # cx,cy = *camera_offset
35
45
  ImageGrid.new(
36
46
  tiles_path: 'media/images/tiles.png',
37
47
  grid: grid,
38
48
  tile_width: 64,
39
49
  tile_height: 64,
40
- offset: [-cx*64, -cy*64]
50
+ offset: camera_offset #[-cx*64, -cy*64]
41
51
  )
42
52
  end
43
53
 
44
54
  def to_screen_coordinates(location:)
45
55
  x,y = *location
46
- cx,cy = *camera_location
47
- [(x * image_grid.tile_width - cx*64), (y * image_grid.tile_height - cy*64)]
56
+ cx,cy = *camera_offset
57
+ [(x * image_grid.tile_width + cx), (y * image_grid.tile_height + cy)]
48
58
  end
49
59
 
50
60
  def background_image
@@ -1,4 +1,4 @@
1
1
  module Dedalus
2
2
  # dedalus version
3
- VERSION = "0.2.11"
3
+ VERSION = "0.2.12"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dedalus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Weissman