arrow: added an entity for pointing at things
This commit is contained in:
parent
65709f0ae0
commit
335b3078b8
2 changed files with 31 additions and 0 deletions
31
entities/arrow.lua
Normal file
31
entities/arrow.lua
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
Class = require 'hump.class'
|
||||||
|
require 'entities/entity'
|
||||||
|
|
||||||
|
local ARROW_IMG = love.graphics.newImage("resources/graphics/arrow-up.png")
|
||||||
|
local ARROW_QUAD = love.graphics.newQuad(0, 0, 90, 90, 90, 90)
|
||||||
|
|
||||||
|
Arrow = Class {
|
||||||
|
__includes = Entity,
|
||||||
|
|
||||||
|
init = function(self, x, y, level, r, g, b)
|
||||||
|
Entity.init(self, x, y, level)
|
||||||
|
self.pointX = 45
|
||||||
|
self.pointY = 90
|
||||||
|
self.r = r
|
||||||
|
self.g = g
|
||||||
|
self.b = b
|
||||||
|
end;
|
||||||
|
|
||||||
|
setX = function(self, x)
|
||||||
|
self.x = x
|
||||||
|
end;
|
||||||
|
|
||||||
|
setY = function(self, y)
|
||||||
|
self.y = y
|
||||||
|
end;
|
||||||
|
|
||||||
|
draw = function(self)
|
||||||
|
love.graphics.setColor(self.r, self.g, self.b);
|
||||||
|
love.graphics.draw(ARROW_IMG, ARROW_QUAD, self.x + self.pointX, self.y + self.pointY, 0, 1, 1, 90, 90)
|
||||||
|
end
|
||||||
|
}
|
BIN
resources/graphics/arrow-up.png
Normal file
BIN
resources/graphics/arrow-up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in a new issue