Tiles can be selected now
This commit is contained in:
parent
c66e9a68b5
commit
05abf401a6
3 changed files with 7 additions and 3 deletions
BIN
public/images/selected.png
Normal file
BIN
public/images/selected.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 946 B |
|
@ -12,7 +12,8 @@ class Tile extends BaseEntity
|
||||||
@isActive = false
|
@isActive = false
|
||||||
|
|
||||||
click: (button)->
|
click: (button)->
|
||||||
console.log button
|
# console.log button
|
||||||
|
@isSelected = true
|
||||||
|
|
||||||
moveIn: ->
|
moveIn: ->
|
||||||
@isActive = true
|
@isActive = true
|
||||||
|
@ -26,5 +27,8 @@ class Tile extends BaseEntity
|
||||||
render: (x, y)->
|
render: (x, y)->
|
||||||
tileLayer = @layers[@currentLayer]
|
tileLayer = @layers[@currentLayer]
|
||||||
app.layer.drawRegion app.images.layers, tileLayer.sprite, x*8, y*8
|
app.layer.drawRegion app.images.layers, tileLayer.sprite, x*8, y*8
|
||||||
if @isActive
|
|
||||||
|
if @isSelected
|
||||||
|
app.layer.drawImage app.images.selected, x*8, y*8
|
||||||
|
else if @isActive
|
||||||
app.layer.drawImage app.images.active, x*8, y*8
|
app.layer.drawImage app.images.active, x*8, y*8
|
||||||
|
|
|
@ -5,7 +5,7 @@ app = playground({
|
||||||
smoothing: false,
|
smoothing: false,
|
||||||
|
|
||||||
create: ->
|
create: ->
|
||||||
@loadImages "layers", "active"
|
@loadImages "layers", "active", "selected"
|
||||||
@currentHoveredTile = new Tile
|
@currentHoveredTile = new Tile
|
||||||
|
|
||||||
ready: ->
|
ready: ->
|
||||||
|
|
Loading…
Reference in a new issue