4.5.9 Building On-Screen Action Indicators

TheRetroBro

Active member
One thing I’ve noticed from watching people play my early games is that certain interactions weren’t always obvious. As developers, things feel clear to us because we built the game—but to players, prompts like “press UP to enter a door” or “press B to read text” aren’t always intuitive.


To solve this, I started adding simple visual cues directly above the player: small sprite-based action indicators that tell the player what button to press.


In this tutorial, we’ll create a basic action indicator, specifically a “press UP” icon that appears above the player when they’re standing in front of a warp door.


First Open your gameobject tiles and create an up arrow on your sprite sheet (this is just going to be a sprite so we DO NOT need to make an object)

1764867222705.png



NOW open your WarpToScreen warp tile…
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;here we start showing up indicator
TXA
PHA
LDX player1_object

CPX player1_object
BEQ +
RTS ; if its not the player, we abort the whole thing
+

LDA Object_x_hi,x
CLC
ADC #05 ;;;;moves to center of player
STA tempA

LDA Object_y_hi,x
SEC
SBC #08
STA tempB

LDA vBlankTimer ;;;;;;;;;;;;;this will flash the icon
AND #%00000010
BEQ +skipdraw

DrawSprite tempA, tempB, #67, #%00000000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;arg 3 is the sprite location on your game objects sheet
+skipdraw
PLA
TAX

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;here we end up indicator


LDA gamepad
AND #%00010000 ;; UP button pressed?
BEQ notPressed
JMP yesPressed
notPressed:
;; not pressed, we stop the script here
RTS

yesPressed:
CPX player1_object
BEQ +
JMP notPlayerForWarpTile
+

LDA #00 ;;;;;;;;;;;;;;stops player
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
LDA Object_direction,x
AND #%00000111
STA Object_direction,x
LDA scrollByte
AND #%00111110
ORA #%00000010
STA scrollByte
WarpToScreen warpToMap, warpToScreen, #$01


That’s it, super simple. You can use this method with practically any interactive tile (press DOWN for an elevator, press B to activate a terminal, and so on).


 
Last edited:
Top Bottom