set optimization noinlinedata dim ea = a dim dy = b dim dx = c dim x1 = temp1 dim x0 = temp2 dim y1 = temp3 dim y0 = temp4 dim delay = h dim rand16 = z player0: %10000000 end player1: %10000000 %00000000 end player1x = 150 : player1y = 60 player0x = 10 : player0y = 15 gosub setup_move loop COLUP0 = $1C COLUP1 = $34 COLUPF = $62 drawscreen delay = delay - 1 temp5 = 0 if joy0right then player1x = player1x + 1 : temp5 = 1 if joy0left then player1x = player1x - 1 : temp5 = 1 if joy0up then player1y = player1y - 1 : temp5 = 1 if joy0down then player1y = player1y + 1 : temp5 = 1 if player1x > 160 then player1x = 16 if player1x < 16 then player1x = 160 if player1y > 88 then player1y = 2 if player1y < 2 then player1y = 88 if collision(player0, player1) then gosub P0_rand : gosub setup_move : gosub set_ea : goto s2 if temp5 then gosub setup_move s2 if delay & 1 then gosub move goto loop P0_rand player0y = rand / 4 : player0y = (player0y / 4) + player0y + 6 player0x = rand / 2 : player0x = (player0x / 4) + player0x return move temp1 = ea if f{0} then skip player0y = player0y + yinc[f] ea = ea - dx if temp1 < ea then ea = ea + dy : player0x = player0x + xinc[f] return skip player0x = player0x + xinc[f] ea = ea - dy if temp1 < ea then ea = ea + dx : player0y = player0y + yinc[f] return setup_move x0 = player0x : y0 = player0y x1 = player1x : y1 = player1y if x0 < x1 then f{2} = 1 : dx = x1 - x0 else f{2} = 0 : dx = x0 - x1 if y0 < y1 then f{1} = 1 : dy = y1 - y0 else f{1} = 0 : dy = y0 - y1 if dx < $80 then dy = dy * 2 : dx = dx * 2 if dx > dy then dx_gt f{0} = 0 if ea > dy then ea = dy / 2 return dx_gt f{0} = 1 if ea > dx then ea = dx / 2 return set_ea if f{0} then ea = dx / 2 else ea = dy / 2 return data yinc $FF, $FF, $01, $01, $FF, $FF,$01, $01 end data xinc $FF, $FF, $FF, $FF, $01, $01, $01, $01 end