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
|
||||
|
||||
click: (button)->
|
||||
console.log button
|
||||
# console.log button
|
||||
@isSelected = true
|
||||
|
||||
moveIn: ->
|
||||
@isActive = true
|
||||
|
@ -26,5 +27,8 @@ class Tile extends BaseEntity
|
|||
render: (x, y)->
|
||||
tileLayer = @layers[@currentLayer]
|
||||
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
|
||||
|
|
|
@ -5,7 +5,7 @@ app = playground({
|
|||
smoothing: false,
|
||||
|
||||
create: ->
|
||||
@loadImages "layers", "active"
|
||||
@loadImages "layers", "active", "selected"
|
||||
@currentHoveredTile = new Tile
|
||||
|
||||
ready: ->
|
||||
|
|
Loading…
Reference in a new issue