[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
+26 -27
View File
@@ -64,9 +64,11 @@ function abad_init()
bb={x=8,y=0,w=16,h=32}, bb={x=8,y=0,w=16,h=32},
safe={hab=10,x=40,y=24}, safe={hab=10,x=40,y=24},
move=abad.move, move=abad.move,
mood="normal"} mood="normal",
vehicle=""}
abad.update=abad_state_normal abad.update=abad_state_normal
abad.objects={} abad.objects={}
-- abad.objects={clau_premiere = true, clau_elalien = true}
end end
function abad:move( x, y ) function abad:move( x, y )
@@ -102,36 +104,33 @@ end
function abad:draw() function abad:draw()
local flip = abad.flip local flip = abad.flip
local x, y = viewp:screen_coords(self.x, self.y) local x, y = viewp:screen_coords(self.x, self.y)
if abad.update==abad_state_stairs then if abad.vehicle=="" then
-- flip=abad.stairs_flip if abad.update==abad_state_stairs then
-- -- flip=(((abad.x>>1)+(abad.y>>1))%2)==0 if math.abs(abad.stairs_moves-(abad.x+abad.y))>12 then
if math.abs(abad.stairs_moves-(abad.x+abad.y))>12 then abad.stairs_moves = abad.x+abad.y
abad.stairs_moves = abad.x+abad.y abad.flip = not abad.flip
abad.flip = not abad.flip end
flip = abad.flip
end end
flip = abad.flip
-- if ((abad.x+abad.y)%12)==0 then
-- abad.stairs_flip=not abad.stairs_flip
-- end
-- local msg = "-- "..abad.x.." "..abad.y if (abad.respawning==0) or (math.floor(abad.respawning/15)%2==0) then
-- if flip then msg = "FLIP"..abad.x.." "..abad.y end draw.surf(abad.frame*abad.w,0,abad.w,abad.h,x,y,abad.w,abad.h,flip)
-- -- msg_print(0,35,msg,true) -- caminant, parat, disparant o saltant
end if abad.frame<=3 or abad.frame==6 then
abad_add_mood(x,0,y,0,flip,abad.mood)
if (abad.respawning==0) or (math.floor(abad.respawning/15)%2==0) then end
draw.surf(abad.frame*abad.w,0,abad.w,abad.h,x,y,abad.w,abad.h,flip)
-- caminant, parat, disparant o saltant
if abad.frame<=3 or abad.frame==6 then
abad_add_mood(x,0,y,0,flip,abad.mood)
end end
end
if abad.respawning > 0 then
abad.respawning=abad.respawning-1
end
-- draw.rect(x+abad.bb.x,y+abad.bb.y,abad.bb.w,abad.bb.h,3) if abad.respawning > 0 then
abad.respawning=abad.respawning-1
end
-- draw.rect(x+abad.bb.x,y+abad.bb.y,abad.bb.w,abad.bb.h,3)
elseif abad.vehicle=="copter" then
surf.source.push(tiles2)
draw.surf(96,0,abad.w,abad.h,x,y,abad.w,abad.h,flip)
surf.source.pop()
end
end end
function abad_make_safe( force ) function abad_make_safe( force )
+32 -10
View File
@@ -28,18 +28,33 @@ copter={
enabled=true, enabled=true,
disable_reason="", disable_reason="",
enabled=true, enabled=true,
rider = nil,
gir = {} gir = {}
} }
function copter.init() function copter.init(rider)
local world_x, world_y = coords.room_to_world(copter.hab,copter.x,copter.y) if rider==nil then
copter.x=world_x local world_x, world_y = coords.room_to_world(copter.hab,copter.x,copter.y)
copter.y=world_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 end
function copter.draw() function copter.draw()
local curr_sf = surf.source() -- local curr_sf = surf.source()
surf.source(tiles2) surf.source.push(tiles2)
local scr_x, scr_y = viewp:screen_coords( copter.x, copter.y ) 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) 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 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+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) draw.line(scr_x+47,scr_y+16,scr_x+43+copter.gir[5],scr_y+8,16)
end end
surf.source(curr_sf) -- surf.source(curr_sf)
surf.source.pop()
end end
function copter.update() function copter.update()
copter.step = copter.step +1 copter.step = copter.step +1
copter.wait = copter.wait +1 copter.wait = copter.wait +1
if copter.wait==16 then if copter.wait==16 then
copter.wait = 0 copter.wait = 0
end 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 end
+2 -1
View File
@@ -82,7 +82,8 @@ function game_load()
surf.cls(16) surf.cls(16)
math.randomseed(os.time()) math.randomseed(os.time())
mapa_surface_init() mapa_surface_init()
states:executar("check-reqs") -- states:executar("check-reqs")
states:executar("title")
controller:init() controller:init()
fonts_init() fonts_init()
images_init() images_init()
+2 -1
View File
@@ -203,8 +203,9 @@ function stages.stage1_init()
tiles_layer2.new(78,6,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya) tiles_layer2.new(78,6,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya)
-- abad init -- abad init
abad.vehicle = ""
local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 ) local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 )
local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 ) -- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 )
-- local abad_x, abad_y = coords.room_to_world ( 8, 9, 3 ) -- local abad_x, abad_y = coords.room_to_world ( 8, 9, 3 )
abad:move(abad_x, abad_y) abad:move(abad_x, abad_y)
abad_make_safe( true ) abad_make_safe( true )
+1 -7
View File
@@ -42,19 +42,13 @@ function stage1_ending:update_scene()
premiere.update() premiere.update()
elseif self.time==400 then elseif self.time==400 then
premiere.stage1_ending_init3() premiere.stage1_ending_init3()
copter.hab=premiere.hab copter.init(premiere)
copter.x=premiere.x
copter.y=premiere.y
-- copter.init()
copter.y=copter.y-16
table.insert( actors, copter) table.insert( actors, copter)
-- music.play(audio_song_copter) -- music.play(audio_song_copter)
music_player:play(audio_song_copter) music_player:play(audio_song_copter)
elseif self.time<720 then elseif self.time<720 then
-- sisena escena - premiere copter -- sisena escena - premiere copter
premiere.update() premiere.update()
copter.x = premiere.x-32
copter.y = premiere.y-48
copter.update() copter.update()
elseif self.time==720 then elseif self.time==720 then
start_scene(scenes.stage1_ending_3, nil, false) start_scene(scenes.stage1_ending_3, nil, false)
+4 -1
View File
@@ -36,14 +36,17 @@ function stages.stage2_init()
table.insert(actors,batvio) table.insert(actors,batvio)
-- abad init -- abad init
abad.vehicle = "copter"
local abad_x, abad_y = coords.room_to_world ( 1, 4, 3 ) local abad_x, abad_y = coords.room_to_world ( 1, 4, 3 )
abad:move(abad_x, abad_y) abad:move(abad_x, abad_y)
abad_make_safe( true ) abad_make_safe( true )
table.insert(actors,copter)
copter.init(abad)
-- viewport init -- viewport init
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y) local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
viewp:free_move() viewp:free_move()
end end
function stages.stage2_update() function stages.stage2_update()
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB