From 9d044d10f985284d24784673082d4da9447cf5f0 Mon Sep 17 00:00:00 2001 From: JailGamer Date: Sun, 31 May 2026 13:46:56 +0200 Subject: [PATCH] [CHG] Ajustos en el copter per a dur conductor --- data/abad.lua | 53 ++++++++++++++++++++--------------------- data/copter.lua | 42 ++++++++++++++++++++++++-------- data/game.lua | 3 ++- data/stage1.lua | 3 ++- data/stage1_ending.lua | 8 +------ data/stage2.lua | 5 +++- data/tiles2.gif | Bin 2490 -> 2487 bytes 7 files changed, 67 insertions(+), 47 deletions(-) diff --git a/data/abad.lua b/data/abad.lua index af82ead..ec66d8a 100644 --- a/data/abad.lua +++ b/data/abad.lua @@ -64,9 +64,11 @@ function abad_init() bb={x=8,y=0,w=16,h=32}, safe={hab=10,x=40,y=24}, move=abad.move, - mood="normal"} + mood="normal", + vehicle=""} abad.update=abad_state_normal abad.objects={} + -- abad.objects={clau_premiere = true, clau_elalien = true} end function abad:move( x, y ) @@ -102,36 +104,33 @@ end function abad:draw() local flip = abad.flip local x, y = viewp:screen_coords(self.x, self.y) - if abad.update==abad_state_stairs then - -- flip=abad.stairs_flip - -- -- flip=(((abad.x>>1)+(abad.y>>1))%2)==0 - if math.abs(abad.stairs_moves-(abad.x+abad.y))>12 then - abad.stairs_moves = abad.x+abad.y - abad.flip = not abad.flip + if abad.vehicle=="" then + if abad.update==abad_state_stairs then + if math.abs(abad.stairs_moves-(abad.x+abad.y))>12 then + abad.stairs_moves = abad.x+abad.y + abad.flip = not abad.flip + end + flip = abad.flip 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 flip then msg = "FLIP"..abad.x.." "..abad.y end - -- -- msg_print(0,35,msg,true) - end - - if (abad.respawning==0) or (math.floor(abad.respawning/15)%2==0) then - 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) + if (abad.respawning==0) or (math.floor(abad.respawning/15)%2==0) then + 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 function abad_make_safe( force ) diff --git a/data/copter.lua b/data/copter.lua index fbe1640..0d26cb5 100644 --- a/data/copter.lua +++ b/data/copter.lua @@ -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 \ No newline at end of file diff --git a/data/game.lua b/data/game.lua index e91cecd..b7a0416 100644 --- a/data/game.lua +++ b/data/game.lua @@ -82,7 +82,8 @@ function game_load() surf.cls(16) math.randomseed(os.time()) mapa_surface_init() - states:executar("check-reqs") + -- states:executar("check-reqs") + states:executar("title") controller:init() fonts_init() images_init() diff --git a/data/stage1.lua b/data/stage1.lua index c31e36c..543fd56 100644 --- a/data/stage1.lua +++ b/data/stage1.lua @@ -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) -- 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 ( 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 ) abad:move(abad_x, abad_y) abad_make_safe( true ) diff --git a/data/stage1_ending.lua b/data/stage1_ending.lua index cb9ad46..fbd9b39 100644 --- a/data/stage1_ending.lua +++ b/data/stage1_ending.lua @@ -42,19 +42,13 @@ function stage1_ending:update_scene() premiere.update() elseif self.time==400 then premiere.stage1_ending_init3() - copter.hab=premiere.hab - copter.x=premiere.x - copter.y=premiere.y - -- copter.init() - copter.y=copter.y-16 + copter.init(premiere) table.insert( actors, copter) -- music.play(audio_song_copter) music_player:play(audio_song_copter) elseif self.time<720 then -- sisena escena - premiere copter premiere.update() - copter.x = premiere.x-32 - copter.y = premiere.y-48 copter.update() elseif self.time==720 then start_scene(scenes.stage1_ending_3, nil, false) diff --git a/data/stage2.lua b/data/stage2.lua index 2857117..dc36663 100644 --- a/data/stage2.lua +++ b/data/stage2.lua @@ -36,14 +36,17 @@ function stages.stage2_init() table.insert(actors,batvio) -- abad init + abad.vehicle = "copter" local abad_x, abad_y = coords.room_to_world ( 1, 4, 3 ) abad:move(abad_x, abad_y) abad_make_safe( true ) + table.insert(actors,copter) + + copter.init(abad) -- viewport init local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y) viewp:free_move() - end function stages.stage2_update() diff --git a/data/tiles2.gif b/data/tiles2.gif index 03a342e36ff66bc0addd6cd129a37e7cafcde334..659490906c11e88cb2be3381ee844113f98d6abb 100644 GIT binary patch delta 308 zcmV-40n7fn6Sor#M@dFFH(>w)00HL$u?)=ze*l=kG#@EPxkrh-@0iKt$rBF~L{&QT zmlS~|G4 ze?<$T(UxkIp~H)5-8iaHb-EOu2Y{(ecbYGc9?q0EZDm$;dKi!L)K^9=YC^f#(qF=b zs3;BTQIY!5VbN5j9t`Rx$x=X)N_DCxO=?W9`qKew6`tUODp;fX)wQxUp@ejvOXoTO z33~Oec+Klc-KwjO#?^attt(##J6L_14pOg(O{`)U%UF`G^s$hWw)00HL@u?)=zf1s5R0H!BNIm$gs{as znZKk6EQzVdMn(pk3_+$gM?%Rtesh7+bfx(qqZe%2Go9=H^aukQ(#{xu)0xi%X8O)) z&w>^dpZVlS5+ldZc7{%s_2b_!2WrrY-t&zKg~$Llx=|E*^rIf_)kiA=(vp^RJ|~3$ ze+m(o(SmUFr5ttW@Mc;!k1}+fFpcK{WJ=SX<_n~UGi6R&nH8QM2Bbdq6;hA7P%ggo zmvAwvN=KShrG|7^Hf5;?hq_6!6wstpttv{FI@7EMb%0!rC-|f))~SZIt!`Z?A)N=) zx(+~sV9l#u_nK0;>guC&^`2et>es>+4tAfW06R$Uk9`0D