New cirno sprite

This commit is contained in:
Marco Giacomelli 2024-04-17 11:54:48 +02:00
commit de8c0e9d3d
2 changed files with 42 additions and 27 deletions

View file

@ -1,4 +1,4 @@
--[[pod_format="raw",created="2024-04-14 14:05:11",modified="2024-04-17 09:28:52",revision=219]]
--[[pod_format="raw",created="2024-04-14 14:05:11",modified="2024-04-17 09:54:34",revision=228]]
--include("/cirnofarm/src/actor.lua")
last_coll=0
mouse_debug = true
@ -29,18 +29,30 @@ function _init()
self.move_x,self.move_y,last_coll),0,0,1)
end,
update=function(self)
local hitbox_x = 4
local hitbox_y = 8
local hitbox_w = 6
local hitbox_h = 8
--self.move_x = self.x
--self.move_y = self.y
if (btn(0)) self.move_x -= self.speed self.hflip = true
if (btn(1)) self.move_x += self.speed self.hflip = false
if (btn(2)) self.move_y -= self.speed
if (btn(3)) self.move_y += self.speed
if (check_collision(self.x+self.move_x,self.y,self.w-1,self.h-1)) then
if (check_collision(self.x+self.move_x+hitbox_x,
self.y+hitbox_y,
hitbox_w,
hitbox_h)) then
if (not self.noclip) then self.move_x = 0 end
end
if (check_collision(self.x,self.y+self.move_y,self.w-1,self.h-1)) then
if (check_collision(self.x+hitbox_x,
self.y+self.move_y+hitbox_y,
hitbox_w,
hitbox_h)) then
if (not self.noclip) then self.move_y = 0 end
end