Skip to content

Commit

Permalink
Keep mouse x/y relative to screen not world
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Moore (Arch) committed Nov 16, 2021
1 parent 2e86c49 commit 4147713
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions assets/sprites/bat_bullet.aseprite
Git LFS file not shown
4 changes: 2 additions & 2 deletions assets/sprites/bat_bullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ build/sprites/bat_bullet.asm: assets/sprites/bat_bullet.png makefile
$(COMPILESPRITE) \
-i assets/sprites/bat_bullet.png \
-o build/sprites/bat_bullet.asm \
-sw 7 -sh 7 \
-sw 9 -sh 9 \
-mi 159


Expand Down
13 changes: 9 additions & 4 deletions src/batman.asm
Original file line number Diff line number Diff line change
Expand Up @@ -951,8 +951,6 @@ main_draw_tile_map_loop:
LDR R2,[R12]

BL draw_tile_map
STR R3,sprite_world_offset_x
STR R4,sprite_world_offset_y
LDR R11,[R12]
BL draw_sprites

Expand Down Expand Up @@ -1032,6 +1030,8 @@ No_L_Key:
CMP R4,#0
MOVLE R4,#0
No_P_Key:
STR R3,sprite_world_offset_x
STR R4,sprite_world_offset_y
MOV R0,#129
MOV R1,#-58
MOV R2,#255
Expand Down Expand Up @@ -1158,11 +1158,16 @@ SpaceBar_Debounce:
SUB R3,R3,R4
STR R3,monotonic_time_delta

MVL R3,sprite_world_offset_x
LDR R4,[R3,#0]
LDR R5,[R3,#4]
MOV R2,R2,LSL #2
STR R2,sprite_31_frame
MOV R2,R0,LSR #2
MOV R3,R1,LSR #2
EOR R3,R3,#0b11111111
ADD R2,R2,R4
ADD R3,R3,R5
STR R2,sprite_31_x
STR R3,sprite_31_y

Expand Down Expand Up @@ -1282,9 +1287,9 @@ update_bat_bullets_loop:
SUBLT R2,R2,#1
AND R2,R2,#0b11111
STR R2,[R10,#sprite_frame]
MOV R2,#7
MOV R2,#9
STR R2,[R10,#sprite_width]
MOV R2,#7
MOV R2,#9
STR R2,[R10,#sprite_height]
DEBUG_REGISTERS
BAL update_bat_bullets_next
Expand Down

0 comments on commit 4147713

Please sign in to comment.