state: adding states for bat enemy
authorLukas Krickl <lukas@krickl.dev>
Thu, 6 Feb 2025 15:56:53 +0000 (16:56 +0100)
committerLukas Krickl <lukas@krickl.dev>
Thu, 6 Feb 2025 15:56:53 +0000 (16:56 +0100)
src/state.s

index e176932ccbabcfb98151852878ac277d7026ae56..b0f0a30bd6b49c0a6d1ede827a302f2b10314b0c 100644 (file)
@@ -110,6 +110,32 @@ sm_player_poll_inputs:
 
   ret
 
+  ; picks a direction for 
+  ; a bat to move in
+  ; then transitions to move state
+  ; after verifying collision
+  ; otherwise -> end turn
+sm_bat_pick_direction:
+  ; move bat in random direction
+  call rand
+  and a, 0b11 ; rnadom direction 0-3
+  
+  ; call correct movement setup
+  cp a, NORTH
+  call z, actor_up
+  cp a, SOUTH
+  call z, actor_down
+  cp a, WEST
+  call z, actor_left
+  cp a, EAST
+  call z, actor_right
+
+  ; verify collision
+  
+  ; transition
+
+  ret
+
   ; loads initial state if 
   ; state is 0
   ; inputs:
@@ -132,3 +158,4 @@ sm_load_initial_state:
 @done:
   pop de
   ret
+