Gotes en el mapa completades!
This commit is contained in:
@@ -7,6 +7,7 @@ require "abad"
|
|||||||
require "cacau"
|
require "cacau"
|
||||||
require "caco"
|
require "caco"
|
||||||
require "zombie"
|
require "zombie"
|
||||||
|
require "gota"
|
||||||
|
|
||||||
local tile_w = arcade_config.tiles_width
|
local tile_w = arcade_config.tiles_width
|
||||||
local tile_h = arcade_config.tiles_height
|
local tile_h = arcade_config.tiles_height
|
||||||
@@ -25,6 +26,19 @@ function game_init(menu)
|
|||||||
abad_init()
|
abad_init()
|
||||||
table.insert(actors,abad)
|
table.insert(actors,abad)
|
||||||
|
|
||||||
|
table.insert( actors, gota.new(70,5,1,20) )
|
||||||
|
table.insert( actors, gota.new(70,9,1,30) )
|
||||||
|
table.insert( actors, gota.new(63,5,1,25,2,-7) )
|
||||||
|
table.insert( actors, gota.new(63,9,1,20,0,-8) )
|
||||||
|
table.insert( actors, gota.new(64,3,1,10,0,-6) )
|
||||||
|
table.insert( actors, gota.new(64,6,1,25,-1,-5) )
|
||||||
|
table.insert( actors, gota.new(65,7,1,10,0,-7) )
|
||||||
|
table.insert( actors, gota.new(65,8,1,25,0,-7) )
|
||||||
|
table.insert( actors, gota.new(66,3,1,10,0,-7) )
|
||||||
|
table.insert( actors, gota.new(66,4,1,15,0,-7) )
|
||||||
|
table.insert( actors, gota.new(77,2,1,30,-5,-7) )
|
||||||
|
table.insert( actors, gota.new(77,9,1,25,-5,-7) )
|
||||||
|
|
||||||
table.insert( actors, caco.new(13,3,2,true ) )
|
table.insert( actors, caco.new(13,3,2,true ) )
|
||||||
table.insert( actors, caco.new(17,3,2,false) )
|
table.insert( actors, caco.new(17,3,2,false) )
|
||||||
table.insert( actors, caco.new(20,3,2,false) )
|
table.insert( actors, caco.new(20,3,2,false) )
|
||||||
@@ -45,7 +59,7 @@ function game_init(menu)
|
|||||||
table.insert( actors, zombie.new(73, 3, 3,false) )
|
table.insert( actors, zombie.new(73, 3, 3,false) )
|
||||||
|
|
||||||
local abad_x, abad_y = arc_mapa_get_coords ( 10, 4, 3 )
|
local abad_x, abad_y = arc_mapa_get_coords ( 10, 4, 3 )
|
||||||
local abad_x, abad_y = arc_mapa_get_coords ( 40, 3, 3 )
|
local abad_x, abad_y = arc_mapa_get_coords ( 77, 3, 2 )
|
||||||
abad:move(abad_x, abad_y)
|
abad:move(abad_x, abad_y)
|
||||||
abad_make_safe( true )
|
abad_make_safe( true )
|
||||||
|
|
||||||
|
|||||||
127
data/gota.lua
Normal file
127
data/gota.lua
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
o2aX = arcade_config.org2arc_escala
|
||||||
|
cxr = arcade_config.character_per_row-1
|
||||||
|
cxr2 = arcade_config.character_per_row_base2
|
||||||
|
cw = arcade_config.character_width
|
||||||
|
ch = arcade_config.character_height
|
||||||
|
-- posició en el gif
|
||||||
|
gota_gif_col = 7
|
||||||
|
gota_gif_row = 0
|
||||||
|
|
||||||
|
gota={}
|
||||||
|
|
||||||
|
function gota.new(_hab,_x,_y,_freq,_x_offset, _y_offset)
|
||||||
|
local world_x, world_y = arc_mapa_get_coords(_hab,_x,_y)
|
||||||
|
_x_offset = _x_offset or 0
|
||||||
|
_y_offset = _y_offset or 0
|
||||||
|
world_x = world_x+_x_offset
|
||||||
|
world_y = world_y+_y_offset
|
||||||
|
return {hab=_hab,
|
||||||
|
ix=world_x,
|
||||||
|
iy=world_y,
|
||||||
|
x=world_x,
|
||||||
|
y=world_y,
|
||||||
|
w=16,
|
||||||
|
h=16,
|
||||||
|
freq=_freq,
|
||||||
|
cx=0,
|
||||||
|
dx=0,
|
||||||
|
dy=0,
|
||||||
|
floor_y=0,
|
||||||
|
wait=0,
|
||||||
|
step=0,
|
||||||
|
hit=gota.hit,
|
||||||
|
update=gota.update_normal,
|
||||||
|
draw=gota.draw_normal,
|
||||||
|
draw_drop= gota.draw_drop,
|
||||||
|
bb={x=4,y=0,w=8,h=12}}
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:draw_normal()
|
||||||
|
local x = gota_gif_col*cw
|
||||||
|
local y = gota_gif_row*ch
|
||||||
|
if viewp:inside(self.x, self.y, self.w, self.h) then
|
||||||
|
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
|
||||||
|
draw.surf(x,y,self.w,self.h,scr_x,scr_y)
|
||||||
|
local x_check = scr_x+self.bb.x+(self.bb.w/2)-1
|
||||||
|
local y_check = scr_y+self.bb.h
|
||||||
|
draw.rectf(x_check,y_check,1,1,4)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:update_normal()
|
||||||
|
self.wait=self.wait+1
|
||||||
|
|
||||||
|
if self.wait==18 then
|
||||||
|
self.wait=0
|
||||||
|
self.step=self.step+1
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.step > self.freq then
|
||||||
|
self.y=self.y+2
|
||||||
|
local x_check = self.x+self.bb.x+(self.bb.w/2)-1
|
||||||
|
local y_check = self.y+self.bb.h
|
||||||
|
|
||||||
|
if arc_check_tile(x_check,y_check)>=tiletype.block then
|
||||||
|
self.update=gota.update_splash
|
||||||
|
self.draw=gota.draw_splash
|
||||||
|
self.floor_y=self.y+8
|
||||||
|
self.cx=self.x+2
|
||||||
|
self.dx=0
|
||||||
|
self.dy=-4
|
||||||
|
self.dy=-2
|
||||||
|
if self.hab==abad.hab then sound.play(audio_low) end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
--self.flip=not self.flip
|
||||||
|
end
|
||||||
|
|
||||||
|
-- if self.hab==abad.hab then
|
||||||
|
-- if aabb(abad,self) then
|
||||||
|
-- abad_hurt(1)
|
||||||
|
-- self.update=gota.update_splash
|
||||||
|
-- self.draw=gota.draw_splash
|
||||||
|
-- self.cx=self.x+2
|
||||||
|
-- self.dx=0
|
||||||
|
-- self.dy=-4
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:hit()
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:draw_drop( x, y )
|
||||||
|
splash_x, splash_y = viewp:screen_coords( x, y )
|
||||||
|
draw.circf( splash_x, splash_y, 2, 16)
|
||||||
|
draw.circf( splash_x, splash_y, 1, 11)
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:draw_splash()
|
||||||
|
local splash_L1_x = (self.cx-self.dx)
|
||||||
|
local splash_L2_x = (self.cx-(self.dx/2))
|
||||||
|
local splash_R1_x = (self.cx+self.dx)
|
||||||
|
local splash_R2_x = (self.cx+(self.dx/2))
|
||||||
|
local splash_U_y = self.y
|
||||||
|
local splash_D_y = self.y-1
|
||||||
|
|
||||||
|
self:draw_drop( splash_L1_x, splash_U_y )
|
||||||
|
self:draw_drop( splash_L2_x, splash_D_y )
|
||||||
|
self:draw_drop( splash_R1_x, splash_U_y )
|
||||||
|
self:draw_drop( splash_R2_x, splash_D_y )
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:update_splash()
|
||||||
|
self.dx=self.dx-1
|
||||||
|
self.dy=self.dy+0.25
|
||||||
|
self.x=self.cx+self.dx
|
||||||
|
self.y=self.y+math.floor(self.dy)
|
||||||
|
|
||||||
|
if self.y>self.floor_y then
|
||||||
|
self.step=0
|
||||||
|
self.update=gota.update_normal
|
||||||
|
self.draw=gota.draw_normal
|
||||||
|
self.x=self.ix
|
||||||
|
self.y=self.iy
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -84,8 +84,8 @@ function mini.init()
|
|||||||
btnCycle2 = tonumber(config.key("btncycle2")) or pad.LEFTSHOULDER
|
btnCycle2 = tonumber(config.key("btncycle2")) or pad.LEFTSHOULDER
|
||||||
btnPause = tonumber(config.key("btnpause")) or pad.START
|
btnPause = tonumber(config.key("btnpause")) or pad.START
|
||||||
|
|
||||||
-- game_init()
|
game_init()
|
||||||
intro_init()
|
-- intro_init()
|
||||||
-- final_init()
|
-- final_init()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
local arcade_config = require("arcade_config")
|
|
||||||
o2aX = arcade_config.org2arc_escala
|
|
||||||
cxr = arcade_config.character_per_row-1
|
|
||||||
cxr2 = arcade_config.character_per_row_base2
|
cxr2 = arcade_config.character_per_row_base2
|
||||||
cw = arcade_config.character_width
|
cw = arcade_config.character_width
|
||||||
ch = arcade_config.character_height
|
ch = arcade_config.character_height
|
||||||
|
|||||||
Reference in New Issue
Block a user