Move Script : MoveRandom_8dir.asm doesn't work

Subotai

Active member
Hi,

Am I the only one that observed that the MoveRandom for monster doesn't work at all.
I'm using 4.5.6 with Metrovania module that come along with that script on script setting already in AI Behavior 1. I've tried too the Adventure 8dir script, doesn't work either.

Am I missing something ?

FYI : Script, for moving left or to movetowardplayer is functionnal.


Here's the original code for MoveRandom_8dir.asm

;;;; Choose out of 4 directions, UDLR.
TXA
STA tempA
JSR doGetRandomNumber
AND #%00000111
TAY
LDA DirectionTable,y
STA tempB
LDA FacingTable,y
STA tempC
StartMoving tempA, tempB, #$00
ChangeFacingDirection tempA, tempC
 

AllDarnDavey

Active member
Some of the side scrolling modules like the Metrovania one have a doHandlePhysics scripts that doesn't check for normal Up & Down movement. Those checks are often stripped out and replaced with gravity / jump which doesn't exist in top down modules. If you do a compare of the doHandlePhysics script the Adventure module uses to the Metroidvania module you can see up & down sections are disabled or removed.

This script tells it to move up or down, but the physics script ignores it. You'd have to put those checks back into the Metrovania physics script, or do the up & down movement through brute force. You can force up and down movement by getting the objects Y position and add or subtract to it. The difference is normal move up will keep moving until told to stop or gravity or inertia slows it to a stop (depending on if you move with inertia or have gravity enabled). But brute forcing up movement you need to subtract from it's Y position every frame, which makes it a little harder to do as an AI script. Left and Right movement and aim movement do not have the same issue.
 
Top Bottom