[CHG] Ajustos en el copter per a dur conductor

This commit is contained in:
2026-05-31 13:46:56 +02:00
parent ef87fd3c25
commit 9d044d10f9
7 changed files with 67 additions and 47 deletions
+32 -10
View File
@@ -28,18 +28,33 @@ copter={
enabled=true,
disable_reason="",
enabled=true,
rider = nil,
gir = {}
}
function copter.init()
local world_x, world_y = coords.room_to_world(copter.hab,copter.x,copter.y)
copter.x=world_x
copter.y=world_y
function copter.init(rider)
if rider==nil then
local world_x, world_y = coords.room_to_world(copter.hab,copter.x,copter.y)
copter.x=world_x
copter.y=world_y
else
copter.rider = rider
copter.hab = rider.hab
copter.x = rider.x-32
copter.y = rider.y-32
copter.y = copter.y-16
end
copter.gir[1] = math.random(8)-1
copter.gir[2] = math.random(4)-1
copter.gir[3] = math.random(8)-1
copter.gir[4] = math.random(6)-1
copter.gir[5] = math.random(8)-1
copter.gir[6] = math.random(4)-1
end
function copter.draw()
local curr_sf = surf.source()
surf.source(tiles2)
-- local curr_sf = surf.source()
surf.source.push(tiles2)
local scr_x, scr_y = viewp:screen_coords( copter.x, copter.y )
draw.surf(0,0,copter.w,copter.h,scr_x,scr_y,copter.w,copter.h,copter.flip)
if copter.wait==0 or copter.wait==32 then
@@ -59,13 +74,20 @@ function copter.draw()
draw.line(scr_x+51,scr_y+23,scr_x+64+copter.gir[4],scr_y+38,16)
draw.line(scr_x+47,scr_y+16,scr_x+43+copter.gir[5],scr_y+8,16)
end
surf.source(curr_sf)
-- surf.source(curr_sf)
surf.source.pop()
end
function copter.update()
copter.step = copter.step +1
copter.wait = copter.wait +1
if copter.wait==16 then
copter.step = copter.step +1
copter.wait = copter.wait +1
if copter.wait==16 then
copter.wait = 0
end
if copter.rider~=nil then
copter.hab = copter.rider.hab
copter.x = copter.rider.x-32
copter.y = copter.rider.y-32
copter.y = copter.y-16
end
end