0

我目前正在easy68k中创建一个简单的空间式资源管理游戏。

我的游戏的一部分包含一个简单的循环,它表示玩家舰队离开基地到他们到达任务目的地的时间点。循环由行驶距离和船舶燃料控制。因此,如果燃料耗尽,那么我将添加一个功能,让玩家知道他们没有到达目的地并且他们已经失去了他们的船。

在所有这些发生之间,我生成了一个从 1 到 100 的随机数,根据生成的数字,可能会发生某些事件,例如玩家会发现一些打捞、船员、废弃船只、海盗等。当其中一个事件发生时我想向控制台屏幕输出一条消息让玩家知道。

我的问题是,当循环运行时,如果发生任何事件,它们都会在不到一秒的时间内全部输出到屏幕上,而玩家最终会错过大多数事件。

我想知道,有没有办法延迟输出,以便以玩家可以轻松跟随的速度出现写作?

任何帮助将不胜感激。

如果这对我的循环有帮助,那么我还没有完全完成所有机制的实现,但循环本身可以正常工作。

      *-------------------------------------------------------
      *---------------Update Mission Progress-----------------
      *  Move to mission location, random events will occur
      *------------------------------------------------------- 
update:
bsr     endl            print a CR and LF
bsr     decorate        decorate with dots using a loop

move.w  $4000, D7       move distance value into D7
move.w  $4020, D6       move fuel value into D6

lea     update_msg,A1   Display update message
move.b  #14,D0
trap    #15

update_loop:

move.b  #8,d0           Get time 1/100th seconds since midnight
trap    #15
and.l   #$5FFFFF,D1     prevent overflow in divu
divu    #100,D1         time count / 100
swap    D1              swap upper and lower words of D1 to put remainder in low word
addq.w  #1,D1           d1.w contains number from 1 to 100
move    D1,D2           d2 = d1

bsr     check_events    check to see if any of the events will occur   

sub.b   #fuel_cost, D6  reduce ships fuel by one
CMP     #0, D6          if the ships fuel reaches 0 then go to out of fuel routine
BEQ     out_of_fuel     

sub.b   #1, D7          reduce mission distance by 1               
CMP     #0, D7          when it reaches 0 go to the continue subroutine            
BNE     update_loop     otherwise go back to the top of the loop

BRA     continue_loop 

continue_loop:
*Used to leave the update loop
lea     continue_msg,A1 
move.b  #14,D0
trap    #15

move.b  #5,D0           wait for input so the player can read the event messages
trap    #15

CMP     $94, D1
BNE     continue_loop


move.w  D6, $4020       store the new value for ship fuel

bsr     decorate                           
rts

check_events:    
*Check to make sure the random value is within the specific range for each event
CMP     #95, D2
BGE     check_found_salvage

CMP     #75, D2
BGE     check_hit_mine

CMP     #55, D2
BGE     check_pirate_attack

CMP     #35, D2
BGE     check_found_ship

CMP     #15, D2
BGE     check_found_crew

rts
*Further checks to make sure the random value is within the specific ranges 
check_found_salvage:

CMP     #97, D2                   
BLE     collect_salvage              
rts                                 

check_hit_mine:

CMP     #77, D2                    
BLE     hit_mine              
rts                 

check_pirate_attack:

CMP     #57, D2                    
BLE     initiate_attack              
rts                 

check_found_ship:

CMP     #37, D2
BLE     check_collect_ship
RTS

check_found_crew:

CMP     #17, D2
BLE     collect_crew
rts
*Run each event, outputting a message to the screen if an event occurs  
collect_salvage:

lea     found_salvage_msg,A1   
move.b  #14,D0
trap    #15

rts                                 

hit_mine:   

lea     hit_mine_msg,A1   
move.b  #14,D0
trap    #15

rts

initiate_attack:    

lea     initiate_attack_msg,A1   
move.b  #14,D0
trap    #15

rts

check_collect_ship:    

lea     found_ship_msg ,A1   
move.b  #14,D0
trap    #15

rts

collect_crew:    

lea     found_crew_msg,A1   
move.b  #14,D0
trap    #15

rts
*Not fully implemented out of fuel mechanic yet
out_of_fuel:
rts
4

1 回答 1

1

根据 Easy68k 论坛的说法,有一个陷阱可以等待指定的时间:

move.l   #100,D1     ; delay in 1/100th of seconds
moveq    #23,D0
trap     #15

您可以在打印事件后使用此陷阱稍等片刻吗?

于 2016-03-04T21:33:47.600 回答