36 | 36 |
outputs button_down, dispatch_game_state,
|
37 | 37 |
actor_pos, actor_delta, actor_logic,
|
38 | 38 |
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
39 | |
trashes a, x, y, c, z, n, v, pos, new_pos, delta, ptr, compare_target, dispatch_logic
|
|
39 |
trashes a, x, y, c, z, n, v, pos, new_pos, delta, ptr, dispatch_logic
|
40 | 40 |
game_state_routine
|
41 | 41 |
|
42 | 42 |
//
|
|
50 | 50 |
typedef routine
|
51 | 51 |
inputs pos, delta, joy2, screen
|
52 | 52 |
outputs pos, delta, new_pos, screen, c
|
53 | |
trashes a, x, y, z, n, v, ptr, compare_target
|
|
53 |
trashes a, x, y, z, n, v, ptr
|
54 | 54 |
logic_routine
|
55 | 55 |
|
56 | 56 |
// ----------------------------------------------------------------
|
|
91 | 91 |
|
92 | 92 |
byte button_down : 0 // effectively static-local to check_button
|
93 | 93 |
byte table[32] press_fire_msg: "PRESS`FIRE`TO`PLAY"
|
94 | |
|
95 | |
word compare_target
|
96 | 94 |
|
97 | 95 |
//
|
98 | 96 |
// Points to the routine that implements the current game state.
|
|
216 | 214 |
add new_pos, delta
|
217 | 215 |
}
|
218 | 216 |
|
219 | |
routine check_new_position_in_bounds
|
|
217 |
define check_new_position_in_bounds routine
|
220 | 218 |
inputs new_pos
|
221 | 219 |
outputs c
|
222 | |
trashes compare_target, a, z, n, v
|
|
220 |
trashes a, z, n, v
|
|
221 |
static word compare_target : 0
|
223 | 222 |
{
|
224 | 223 |
copy 1000, compare_target
|
225 | 224 |
st on, c
|
|
320 | 319 |
}
|
321 | 320 |
|
322 | 321 |
define enemy_logic logic_routine
|
|
322 |
static word compare_target : 0
|
323 | 323 |
{
|
324 | 324 |
call calculate_new_position
|
325 | 325 |
call check_new_position_in_bounds
|
|
371 | 371 |
} else {
|
372 | 372 |
copy $ffd8, delta
|
373 | 373 |
}
|
374 | |
trash compare_target
|
375 | 374 |
}
|
376 | 375 |
|
377 | 376 |
st off, c
|