- Primer 'redo' de part del codi
- Afegida la pantalla de titol
This commit is contained in:
@@ -4,9 +4,11 @@ warp={
|
||||
update=update_all,
|
||||
}
|
||||
|
||||
function warp.init()
|
||||
function warp.init(tiles_sf)
|
||||
local curr_source = surf.source()
|
||||
local curr_target = surf.target()
|
||||
warp_sf=surf.new(32,32)
|
||||
surf.source(tiles)
|
||||
surf.source(tiles_sf)
|
||||
surf.target(warp_sf)
|
||||
local sprite_x = 11*16
|
||||
local sprite_y = 15*16
|
||||
@@ -14,6 +16,12 @@ function warp.init()
|
||||
draw.surfrot(sprite_x, sprite_y, 16, 16, 15, 0, 90)
|
||||
draw.surfrot(sprite_x, sprite_y, 16, 16, 15, 15, 180)
|
||||
draw.surfrot(sprite_x, sprite_y, 16, 16, 0, 15, 270)
|
||||
surf.source(curr_source)
|
||||
surf.target(curr_target)
|
||||
end
|
||||
|
||||
function warp.close()
|
||||
surf.free(warp_sf)
|
||||
end
|
||||
|
||||
function warp.new(_actor)
|
||||
@@ -39,9 +47,12 @@ function warp:draw()
|
||||
if not self.alive then return end
|
||||
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
|
||||
local curr_sf=surf.source()
|
||||
local target_sf=surf.target()
|
||||
surf.source(warp_sf)
|
||||
surf.target(0)
|
||||
draw.surfrot(0,0,32,32,scr_x,scr_y,self.angle)
|
||||
surf.source(curr_sf)
|
||||
surf.target(target_sf)
|
||||
end
|
||||
|
||||
function warp:update()
|
||||
@@ -83,79 +94,3 @@ function warp.update_all()
|
||||
end
|
||||
end
|
||||
|
||||
-- function warp:draw()
|
||||
-- if self.frame>0 then
|
||||
-- local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
|
||||
-- draw.surf((self.frame&7)*cw, (self.frame>>cxr2)*ch, cw, ch, scr_x, scr_y, cw, ch, self.flip)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- function warp:update_normal()
|
||||
-- self.wait=self.wait+1
|
||||
--
|
||||
-- if self.wait==18 then
|
||||
-- self.wait=0
|
||||
-- self.step=(self.step+1)%4
|
||||
-- self.frame=self.anim[self.step+1]
|
||||
-- end
|
||||
--
|
||||
-- local step = 1
|
||||
-- if self.flip then step = -step end
|
||||
-- local inc = 0
|
||||
-- if self.flip then inc = self.bb.w end
|
||||
--
|
||||
-- local check_x = self.x+self.bb.x+step
|
||||
-- local check_ywall = self.y+self.h-2
|
||||
-- local check_yhole = self.y+self.h+1
|
||||
-- if not self.flip then
|
||||
-- check_x = self.x+self.bb.w+self.bb.x+step
|
||||
-- end
|
||||
--
|
||||
-- local check_no_wall= arc_check_tile(check_x,check_ywall)<tiletype.block
|
||||
-- local check_no_hole= arc_check_tile(check_x,check_yhole)~=tiletype.void
|
||||
-- if check_no_wall and check_no_hole then
|
||||
-- self.x=self.x+step
|
||||
-- else
|
||||
-- self.flip=not self.flip
|
||||
-- end
|
||||
--
|
||||
-- if viewp:inside(self.x, self.y, self.w, self.h) then
|
||||
-- if collision(abad,self) then
|
||||
-- abad_hurt(1)
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- -- if self.hab==abad.hab then
|
||||
-- -- if aabb(abad,self) then
|
||||
-- -- abad_hurt(1)
|
||||
-- -- end
|
||||
-- -- end
|
||||
--
|
||||
-- --if check_tile(self.hab,self.x+4,self.y+16)==tiletype.void and ((self.x+4)&7==0 or check_tile(self.hab,self.x+12,self.y+16)==tiletype.void) then
|
||||
-- -- self.flip=not self.flip
|
||||
-- --end
|
||||
-- end
|
||||
--
|
||||
-- function warp:update_hit()
|
||||
-- self.wait=self.wait+1
|
||||
--
|
||||
-- if self.wait>=6 then
|
||||
-- self.wait=0
|
||||
-- self.step=self.step+1
|
||||
-- if self.step<40 then
|
||||
-- if self.step%2==0 then
|
||||
-- self.frame=16
|
||||
-- else
|
||||
-- self.frame=-1
|
||||
-- end
|
||||
-- elseif self.step>=40 then
|
||||
-- self.step=0
|
||||
-- self.wait=0
|
||||
-- self.update=warp.update_normal
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- function warp:hit()
|
||||
-- self.update=warp.update_hit
|
||||
-- end
|
||||
|
||||
Reference in New Issue
Block a user