Browse Source

UI Placeholders up

master
NCLanceman 7 months ago
parent
commit
7345e5978d
  1. BIN
      assets/ui/red_rocket.png
  2. 5
      entities/enemy.lua
  3. 32
      userInterface.lua

BIN
assets/ui/red_rocket.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

5
entities/enemy.lua

@ -22,7 +22,7 @@ function Enemy:new(x, y, radius, playableArea)
self.height = 22 self.height = 22
self.width = 24 self.width = 24
self.x_offset = 18 --18 self.x_offset = 18
self.y_offset = 20 self.y_offset = 20
self.hitbox = { self.hitbox = {
@ -41,6 +41,7 @@ end
function Enemy:draw() function Enemy:draw()
--draw stuff --draw stuff
love.graphics.rectangle("line", self.hitbox[1], self.hitbox[3], self.width, self.height) love.graphics.rectangle("line", self.hitbox[1], self.hitbox[3], self.width, self.height)
--TODO: Resolve this magic number bullshit on line 52. (Why do I subtract 4?)
love.graphics.draw( love.graphics.draw(
self.image, self.image,
self.x, self.x,
@ -48,7 +49,7 @@ function Enemy:draw()
3.14159, 3.14159,
1, 1,
1, 1,
(self.x_offset + self.width * 2), (self.x_offset + self.width * 2 - 4),
(self.y_offset + self.height * 2) (self.y_offset + self.height * 2)
) )

32
userInterface.lua

@ -1,10 +1,14 @@
User_Interface = Object:extend() User_Interface = Object:extend()
local emblem
--Set game canvas size --Set game canvas size
function User_Interface:new(window_width, window_height) function User_Interface:new(window_width, window_height)
self.playableSpace = { window_width, window_height, (window_width * 0.25) } self.playableSpace = { window_width, window_height, (window_width * 0.25) }
self.score = 0 self.score = 0
emblem = love.graphics.newImage("/assets/ui/red_rocket.png")
love.window.setMode((window_width * 1.5), window_height) love.window.setMode((window_width * 1.5), window_height)
end end
--set window size --set window size
@ -13,8 +17,36 @@ function User_Interface:draw()
local left_line = self.playableSpace[3] local left_line = self.playableSpace[3]
local right_line = self.playableSpace[1] + self.playableSpace[3] local right_line = self.playableSpace[1] + self.playableSpace[3]
local window_height = self.playableSpace[2] local window_height = self.playableSpace[2]
--draw the stuff on the left
love.graphics.line(left_line, 0, left_line, window_height) love.graphics.line(left_line, 0, left_line, window_height)
love.graphics.setColor(0.1, 0.1, 0.1)
love.graphics.rectangle("fill", 0, 0, left_line, window_height)
love.graphics.setColor(1, 1, 1)
love.graphics.circle("line", 50, 50, 25)
love.graphics.draw(emblem, 25, 25, 0, 0.25, 0.25)
--Game Message
love.graphics.print("Little Space Game!", 10, 200)
love.graphics.setColor(0, 0.75, 0)
love.graphics.print("Score: Placeholder", 10, 250)
love.graphics.setColor(0, 0, 0)
love.graphics.setColor(0.75, 0, 0)
love.graphics.print("Health: Placeholder", 10, 300)
love.graphics.setColor(1, 1, 1)
--draw the stuff on the right
love.graphics.line(right_line, 0, right_line, window_height) love.graphics.line(right_line, 0, right_line, window_height)
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", right_line, 0, left_line, window_height)
love.graphics.setColor(1, 1, 1)
--Stage Messages
love.graphics.print("Stage 1: In Progress", right_line + 10, 200)
love.graphics.print("Stage: Enemy Swarm", right_line + 10, 250)
end end
--set --set

Loading…
Cancel
Save