4.5.6 Inertia not quite right

WillElm

New member
Anyone notice that when you have a low acceleration speed, your acceleration completely inverts when you change direction? so you don't have to slow down first and you just maintain the same speed you had before you turned around. This doesn't give you the feeling of inertia. I loaded my 4.1.5 project just to double check that that wasn't normal behavior. I tried different movement scripts, but that didn't help anything. Anyone here know where to look? Any help is appreciated. Oh yeah, I've tried in both the arcade and the scrolling module.
 

mouse spirit

Well-known member
Maybe dohandlephysics? Maybe Object_hspeed_lo?
I am guessing.

I do know what you are saying. It is true for me also.
 

WillElm

New member
Below is the code for oStartMovingInADirection, which gets JSR in the StartMoving macro. It has this comment, which is the exact behavior that I want. I'm gonna poke around here, but it's definitely just poking around.

STA temp ;; temp now blanks out the direction that the object is moving, either h or v
;; and turns off acceleration in the opposite, while preserving the "direction"
;; of inertia, so that it may still deccelerate in that direction.
;; This is important for anything that isn't an abrupt direction change, but rather
;; has acceleration / decceleration

Like maybe the wrong direction is getting loaded into temp1 here:

LDA Object_direction,x
AND temp
ORA arg1_hold
ORA temp1
STA Object_direction,x

Here is the macro:

I think it and oStartMovingInADirection compare the object's direction from the movement input scripts to...the object's current direction?

Code:
MACRO StartMoving arg0, arg1
	;arg0 = object
	;arg1 = direction

	TXA
	PHA
	
	LDA arg0
	STA arg0_hold
	LDA arg1
	STA arg1_hold

	
	JSR oStartMovingInADirection
	
	PLA
	TAX
	
	
	ENDM




Code:
oStartMovingInADirection:
	LDA arg0_hold
	TAX

	;;;;;;;;;;;;;;;;;;;;;;
		LDA Object_direction,x
		AND #%00001111 ; these bits need to be preserved
		STA temp1
		
		LDA arg1_hold
		AND #%10000000
		BEQ notChangingDirectionH
			;; is changing direction H
			LDA #%00011111
			JMP gotChangDirectionBlankout
		notChangingDirectionH:
			;; is changing direction V
			LDA #%01001111
		gotChangDirectionBlankout:
			STA temp ;; temp now blanks out the direction that the object is moving, either h or v
					;; and turns off acceleration in the opposite, while preserving the "direction"
					;; of inertia, so that it may still deccelerate in that direction.
					;; This is important for anything that isn't an abrupt direction change, but rather
					;; has acceleration / decceleration
			
		LDA Object_direction,x
		AND temp
		ORA arg1_hold
		ORA temp1
		STA Object_direction,x
		
		
		
		
	;;; right now, speed argument is unused,
	;;; as in default physics, max speed is maintained
	;;; in LUTs, and acceleration to that value
	;;; determines the speed.
	RTS
 

WillElm

New member
**UPDATE** As per Joe's post on facebook, this issue has been fixed and will go live at some point soon.

oops didn't mean to bump, I thought I pressed edit and not quote.
 
What is the fix for this? It still happens in my game, so I guess I dont have the latest version of something and I would like to know what changed. Also what facebook post are you referring to, I searched the group and wasn't able to find anything related to this at all.
 

m8si

Active member
Having issues with this too. Does anyone know how to fix the sudden direction change?
 
Top Bottom