clean up and render player quad
This commit is contained in:
parent
b183853f77
commit
8f89883cb8
12 changed files with 16 additions and 10 deletions
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 434 B |
Binary file not shown.
BIN
two_player_cleaning_game/assets/player.aseprite
Normal file
BIN
two_player_cleaning_game/assets/player.aseprite
Normal file
Binary file not shown.
BIN
two_player_cleaning_game/assets/player.png
Normal file
BIN
two_player_cleaning_game/assets/player.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 355 B |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 184 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 242 B |
Binary file not shown.
|
Before Width: | Height: | Size: 254 B |
|
|
@ -1,7 +1,6 @@
|
||||||
(local map-util (require "map-util.fnl"))
|
(local map-util (require "map-util.fnl"))
|
||||||
|
|
||||||
(var player-01-sprite nil) ; 25x25 pixels
|
(var player-art nil) ; 25x50 pixels each player is 25x25
|
||||||
(var player-02-sprite nil) ; 25x25 pixels
|
|
||||||
(var dust-sprite nil) ; 35x35 pixels
|
(var dust-sprite nil) ; 35x35 pixels
|
||||||
(local game-state {
|
(local game-state {
|
||||||
:player-pos [0 0]
|
:player-pos [0 0]
|
||||||
|
|
@ -33,10 +32,16 @@
|
||||||
(map-util:load)
|
(map-util:load)
|
||||||
(love.window.setMode 600 640)
|
(love.window.setMode 600 640)
|
||||||
|
|
||||||
(set player-sprite (love.graphics.newImage "assets/player_001.png"))
|
|
||||||
|
(set player-art {
|
||||||
|
:player-sprite (love.graphics.newImage "assets/player.png")
|
||||||
|
:player1-quad (love.graphics.newQuad 0 0 25 25 50 25)
|
||||||
|
:player2-quad (love.graphics.newQuad 25 0 25 25 50 25)
|
||||||
|
})
|
||||||
|
|
||||||
(set dust-sprite (love.graphics.newImage "assets/dust_001.png"))
|
(set dust-sprite (love.graphics.newImage "assets/dust_001.png"))
|
||||||
(start-level)
|
(start-level)
|
||||||
(print (fennel.view game-state))
|
; (print (fennel.view game-state))
|
||||||
;; start a thread listening on stdin
|
;; start a thread listening on stdin
|
||||||
(: (love.thread.newThread "require('love.event')
|
(: (love.thread.newThread "require('love.event')
|
||||||
while 1 do love.event.push('stdin', io.read('*line')) end") :start))
|
while 1 do love.event.push('stdin', io.read('*line')) end") :start))
|
||||||
|
|
@ -68,9 +73,9 @@ while 1 do love.event.push('stdin', io.read('*line')) end") :start))
|
||||||
(each [y cells (ipairs (. game-state :world))]
|
(each [y cells (ipairs (. game-state :world))]
|
||||||
(each [x cell (ipairs cells)]
|
(each [x cell (ipairs cells)]
|
||||||
(case [(. cell :revealed) (. cell :type)]
|
(case [(. cell :revealed) (. cell :type)]
|
||||||
[false _] (do
|
; [false _] (do
|
||||||
(love.graphics.setColor 1 1 1) ; reset color to white (no tinting)
|
; (love.graphics.setColor 1 1 1) ; reset color to white (no tinting)
|
||||||
(love.graphics.draw dust-sprite (+ 45 (* 25 (- x 1))) (+ 45 (* 25 (- y 1)))))
|
; (love.graphics.draw dust-sprite (+ 45 (* 25 (- x 1))) (+ 45 (* 25 (- y 1)))))
|
||||||
[true :wall] (do
|
[true :wall] (do
|
||||||
(love.graphics.setColor (unpack black))
|
(love.graphics.setColor (unpack black))
|
||||||
(love.graphics.rectangle "fill" (+ 50 (* 25 (- x 1))) (+ 50 (* 25 (- y 1))) 25 25))
|
(love.graphics.rectangle "fill" (+ 50 (* 25 (- x 1))) (+ 50 (* 25 (- y 1))) 25 25))
|
||||||
|
|
@ -103,10 +108,11 @@ while 1 do love.event.push('stdin', io.read('*line')) end") :start))
|
||||||
:e 0
|
:e 0
|
||||||
:w 25)
|
:w 25)
|
||||||
]
|
]
|
||||||
(love.graphics.draw player-sprite
|
(love.graphics.draw
|
||||||
|
(. player-art :player-sprite)
|
||||||
|
(. player-art :player1-quad)
|
||||||
(+ (* 25 player-x) x-offset 25)
|
(+ (* 25 player-x) x-offset 25)
|
||||||
(+ (* 25 player-y) y-offset 25)
|
(+ (* 25 player-y) y-offset 25))))
|
||||||
rot 1.25 1.25)))
|
|
||||||
|
|
||||||
(fn draw-ghost-grid []
|
(fn draw-ghost-grid []
|
||||||
(love.graphics.setColor (unpack black-half-tone))
|
(love.graphics.setColor (unpack black-half-tone))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue