Simple move up script in scrolling platformer module not working

WillElm

New member
I'm making a scrolling platformer and I'm looking into using the switching between objects code (http://nesmakers.com/viewtopic.php?f=3&t=1760&hilit=switch+object to have a flying ability. I was just gonna make it so the object switched to would ignore gravity. I'm thinking I could probably do this with action states too.

But...it seems like I can't even get the simple move up code from the shooter module to work. It's literally just

StartMoving player1_object, MOVE_UP

RTS

I thought it would be weird if the scrolling platformer didn't allow for up and down movement without modification, so it must be user error. Maybe my jump code is somehow disallowing up/down movement?
 

dale_coop

Moderator
Staff member
By default, the scrolling module doesn't allow to move up or down if "ignore gavity" is set, for better performance...
But if you want your "ignore gravity" flagged objects to be able to move up/down, you can try the fix here: http://nesmakers.com/viewtopic.php?f=35&t=1939
 

WillElm

New member
interesting, thanks for the insight. I have implemented that fix...I suspect it only changed it for monster objects? My monsters are able to move vertically. If I'm wrong about that it must be user error and I just have to spend more time with it. I'm pretty sure I'm wiring it up correctly, and I've tried with both no screen gravity and with the ignore gravity flag.
 

dale_coop

Moderator
Staff member
The fix should work for any object... But I never tested it with the Player (object 0) that is a special object, maybe some other parts of the engine prevent him to move freely vertically.
(I will do some tests tonight).
 

WillElm

New member
It does look like it doesn't work with the player object. I used your switch player object script to change to one of my monsters that moves in all four directions. At the action steps where it's supposed to move up or down, it just stayed still.
 

dale_coop

Moderator
Staff member
How have you set your Player object action steps? I assume not all steps are "ignore gravity"...?
I think, when you press Up / Down the walking (action step 1) is triggered... so, your player is not ignoring gravity (the "ignore grvaity" flag not set for action step 1)...?

You could try to use custom scripts for moving Up and moving Down... that would use another action step (flying).
 

WillElm

New member
I'll take a video of the behavior later. All action steps on the object I switched to have ignore gravity set. I can jump up in the air as my main object, then switch to the monster object, which stays in the air. But then it only moves left and right, not up in down, but it stays suspended in the air the whole time. Then I can switch back to the main object and he falls back down to the ground
 

dale_coop

Moderator
Staff member
Ok... I just checked the code from my tutorial (Fixing ignore gravity) and I think I made an exception for the player.
Open the "UserSubroutines.asm"script (located in your "Routines\Basic\ModuleScripts\" folder).
Try commenting out the lines (";" in front of each line):
Code:
	; CPX player1_object							;; check if it's the player
	; BEQ doneUpdatingXPosForNonPlayerObjects
(You have to th that for the lines 5-6 and 24-25).

Now, I think it should work for the player, too.
 

WillElm

New member
I'll try it tonight. Thanks! You're a boss. After I test it, if you don't do this already, I'll post it to the original thread for people to consider.
 
If anyone else happens to stumble upon this like I did, I can confirm this change works (at least, initially, there may be other issues I haven't run into yet, collission might be off? )
 
Top Bottom