Idle animation not activating 4.1

Having trouble compiling code? Getting an unexpected error? Player not appearing on screen? Seeking answers on how to do a particular thing? This is the forum you're looking for, to ask other NESmaker users for assistance.
User avatar
Mugi
Posts: 808
Joined: Thu Dec 27, 2018 8:30 pm

Re: Idle animation not activating 4.1

Post by Mugi » Tue Jan 08, 2019 11:19 am

dale's is propably a better solution.
at the point where i posted my scripts here, they were going through some quite rough poking.

what matters is that either works, so people can get over that problem :)
"what are you up to?" "Oh, not much... just... Parallaxing"
- Raftronaut
jermz
Posts: 9
Joined: Mon Dec 10, 2018 12:32 am

Re: Idle animation not activating 4.1

Post by jermz » Fri Jan 11, 2019 4:56 am

Is anyone having this problem with the Adventure module? My animations aren't changing when I move and stop (walking to idle) even though I'm certain it's all set up correctly in the player object properties, even followed the steps in the Input Management tutorial.
jermz
Posts: 9
Joined: Mon Dec 10, 2018 12:32 am

Re: Idle animation not activating 4.1

Post by jermz » Fri Jan 11, 2019 6:46 am

In case anyone is having the same issue as I was with the Adventure module, this is what I did. Assuming Action 0 is idle and Action 1 is walking for the player object animations, I added these lines to the StartMovingPlayer* scripts right after the first instance of the + label (single line with only a + on it):

Code: Select all

    GetCurrentActionType player1_object
    CMP #$01
    BEQ ++++++
    ChangeObjectState #$01, #$04
++++++
and this to the StopMovingPlayer* scripts, also after the first instance of the + label:

Code: Select all

    GetCurrentActionType player1_object
    CMP #$00
    BEQ ++++++
    ChangeObjectState #$00, #$04
++++++
This should, if I've done it correctly, start the correct animations for idle and walking if they are not already running, in any game the doesn't have the gravity flag set (eg. games where you don't jump or fall). I tested it and it seems to work :) but then again, I've just started this project so hopefully it doesn't break anything.
User avatar
dale_coop
Posts: 5215
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Idle animation not activating 4.1

Post by dale_coop » Fri Jan 11, 2019 7:04 am

Thanks jermz, looks good. Will try that today.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
jermz
Posts: 9
Joined: Mon Dec 10, 2018 12:32 am

Re: Idle animation not activating 4.1

Post by jermz » Wed Jan 16, 2019 11:04 pm

So I realized I made a mistake/missed something. There are definitely scripts for changing to idle/walk animations already, they just weren't showing up before when I was adding input scripts. I've had some trouble with open/save dialogs on my system loading really slow and file lists loading really slow so I'm just going to guess that's why I couldn't see all the scripts before. The code I posted before should be unnecessary and if someone for some reason wanted to hard-code that behavior into the movement scripts, they should just refer to the changeToIdleAnimation and changeToWalkingAnimation asm scripts.
User avatar
dale_coop
Posts: 5215
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Idle animation not activating 4.1

Post by dale_coop » Wed Jan 16, 2019 11:23 pm

jermz, the "changeToIdleAnimation" and "changeToWalkingAnimation" are old scripts from previous version, they don't exists anymore in the 4.1 (and are obsolete). This leads me to this question: what version are you using? The 4.0 maybe?
Every versions of NESMaker have their own particularities, specificities, issues, ... an answer that work for the 4.1 would not work the the 4.0 and vice-versa.

So yep, if you are in 4.0 and having issues with animations... your answers are in the adventure module tutorial video for the 4.0 (on youtube) and your input editor links issues could find answers maybe here: http://nesmakers.com/viewtopic.php?t=533
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
jermz
Posts: 9
Joined: Mon Dec 10, 2018 12:32 am

Re: Idle animation not activating 4.1

Post by jermz » Mon Jan 21, 2019 2:05 am

dale_coop wrote:
Wed Jan 16, 2019 11:23 pm
jermz, the "changeToIdleAnimation" and "changeToWalkingAnimation" are old scripts from previous version, they don't exists anymore in the 4.1 (and are obsolete). This leads me to this question: what version are you using? The 4.0 maybe?
Every versions of NESMaker have their own particularities, specificities, issues, ... an answer that work for the 4.1 would not work the the 4.0 and vice-versa.

So yep, if you are in 4.0 and having issues with animations... your answers are in the adventure module tutorial video for the 4.0 (on youtube) and your input editor links issues could find answers maybe here: http://nesmakers.com/viewtopic.php?t=533
In v.4.1.0 0x158, those "change animation" scripts are in GameEngineData>Routines>Basic>ModuleScripts>MovementScripts subdirectory, whereas before they were in a module specific subdirectory AFAIK. They seem to still function as in previous versions. It's possible that a newer build of NesMaker 4.1 came out after I installed mine, though.
User avatar
dale_coop
Posts: 5215
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Idle animation not activating 4.1

Post by dale_coop » Mon Jan 21, 2019 8:15 am

It's not they don't work... it's just we don't need to use them anymore in the 4.1 because everything is done with the StartMovingPlayerXXX.asm and StopMovingPlayerXXX.asm (movements, facing and animations).
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
User avatar
Lother
Posts: 118
Joined: Tue Mar 06, 2018 5:30 pm
Location: France

Re: Idle animation not activating 4.1

Post by Lother » Fri Feb 22, 2019 10:22 pm

So how the complete code should look like ? Because when I compile, I end up with that:
Routines\Basic\ModuleScripts\MainScripts\ScrollingPlatformer\ExtraControllReadCode.asm(50): Branch out of range.
For information I've added the bit of code for fixing the jump animation by Mugi and the idle animation fix by Dale-coop and nothing else.

Here's my code:

Code: Select all

ExtraInputControl:

    ;;; occasionally, there is input code that may be very specific, and it may be 
    ;;; difficult to implement via the visual interface and accompanying scripts.
    ;;; this is a code that runs after all input checks, and allows for custom ASM.
    LDA gameState
    CMP #GS_MainGame
    BEQ doMainGameUpdates
    JMP skipMainGameExtraInputControl
doMainGameUpdates:  
    LDX player1_object

	GetCurrentActionType player1_object
	STA temp
	LDA Object_physics_byte,x
	AND #%00000010
	BEQ isNotClimbing
    LDA temp
    CMP #$04
    BNE isNotClimbing
	LDA gamepad
	AND #%11000000
	BEQ noDirWhileClimbing
	ChangeObjectState #$02, #$04
noDirWhileClimbing:
    ;;; is climbing.
    ;;; which means don't check to change to idle.
   JMP skipMainGameExtraInputControl
isNotClimbing:
    LDA temp
    CMP #$03 ;; is it shooting (shooting is same anim in air and on ground)
    BNE isNotAttackingAction
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    JMP skipMainGameExtraInputControl
isNotAttackingAction:   

    
    LDA gamepad
    AND #%11000000 ;;; left and right
    BEQ dontskipMainGameExtraInputControl
	JMP skipMainGameExtraInputControl
dontskipMainGameExtraInputControl:
    ;;; if left and right are not pressed
	
	LDA screenFlags
	AND #%00100000 ;; does it use gravity?
					;; if it does not, it would not have jumping or ducking, so
					;; skip state updates for jumping and ducking.
	BEQ notDucking ;; just will change to idle.

    LDA Object_physics_byte,x
    AND #%00000001 ;; if is in air
    BNE notInAir
    GetCurrentActionType player1_object
    CMP #$02 ;; is it already state 2?
    BEQ skipMainGameExtraInputControl

    ChangeObjectState #$02, #$04
    JMP skipMainGameExtraInputControl
notInAir:
				; add an extra "set to idle state" here for fixing jump state animation glitching.
	ChangeObjectState #$00, #$03
	LDA Object_h_speed_lo,x
	ORA Object_h_speed_hi,x
    BNE skipMainGameExtraInputControl
    ;;;; controller is not pressed
    ;;;; horizontal speed is zero.
    ;; check to see if in air, shooting, etc.
	 LDA gamepad
	AND #%00100000 ; if down is pressed
	BEQ notDucking
	 ChangeObjectState #$5, #$04
	 JMP skipMainGameExtraInputControl
skipMainGameExtraInputControl:
	RTS

notDucking:
	LDA gamepad
	AND #%11110000
	BNE skipMainGameExtraInputControl2
	GetCurrentActionType player1_object  ; check curren state
	BEQ skipMainGameExtraInputControl2   ; if already 0, don't change it again.
	ChangeObjectState #$00, #$04
skipMainGameExtraInputControl2:
	RTS
_____
The game I'm currently working on : FIGHT OF THE PHOENIX

One of the 2D graphical artist who worked on MonsterBoy and the Cursed Kingdom.
User avatar
dale_coop
Posts: 5215
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Idle animation not activating 4.1

Post by dale_coop » Sat Feb 23, 2019 8:43 am

Because the notDucking is too far for the the branch out..
You could try reversing the tests... replacing every:

Code: Select all

	BEQ notDucking
By:

Code: Select all

	BNE +
	JMP notDucking
	+
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
Post Reply