[4.5.6] A fully fonctonnal moving platform ?

Lother

Member
Hello there, for my game I need a fully fonctionnal moving platform.

By fully fonctionnal I mean a platform that carries along the player with its movements and not one wherethe player stay perfectly still while the platform moves away.

Right I got a moving platform by creating a monster. Then I gave it the tag NPC and a bounding box and finally gave it some movement. This work fine BUT for one thing:

It doesn't carry around the player. We have to move along its movement in order to stay on it.

How to solve that ?
 

mouse spirit

Well-known member
I think we would add the speed of player and monster together when "colliding" .(Essentially) so we will always move when monster moves,but move more when player moves.
We might also need a "totalplayerspeed" variable that is the combination of both speeds.
 

Lother

Member
And how do I pull that off, please? I don't know how to code.

(I should really learn how to code in assembly)
 

PasseGaming

Active member
Lother said:
And how do I pull that off, please? I don't know how to code.

(I should really learn how to code in assembly)

you and I both, I keep futzing around with the code to try and get a better understanding of it. I'm hoping if I do it long enough it will begin to click where I can write my own for NES maker.
 

weapon121

Member
If you follow along the bouncing platform example I posted, you should get an Idea of how to get it done. I actually started on it before settling for a "bouncing" one for my needs, but once I finish the byte-off demo, If you havent figured it out, ill help you out on this one ;) this is the link to myne. Its in 4.1.5, but the concept is pretty much the same...Hijack a monster to get it done ;) :

http://nesmakers.com/viewtopic.php?f=35&t=5616
 

Baigomax

New member
If you follow along the bouncing platform example I posted, you should get an Idea of how to get it done. I actually started on it before settling for a "bouncing" one for my needs, but once I finish the byte-off demo, If you havent figured it out, ill help you out on this one ;) this is the link to myne. Its in 4.1.5, but the concept is pretty much the same...Hijack a monster to get it done ;) :

Hi,
I just saw your demo, very impressive!
I need a hand to bring it to 4.5.9. Do you know how to set Immune to weapon an No hurt recoil in 4.5.9?
thank you in advance!!
 

dale_coop

Moderator
Staff member
Sorry... it's holiday season, I am over busy right now, can't work on more scripts... also
check how the "NPC" flag is used... because the npc don't harm or recoil and they are kinda "solid"...!?
 

Jonny

Well-known member
Sorry... it's holiday season, I am over busy right now, can't work on more scripts... also
check how the "NPC" flag is used... because the npc don't harm or recoil and they are kinda "solid"...!?
Enjoy your break Dale. Nice and peaceful without us Brits coming over.
 

Baigomax

New member
Sorry... it's holiday season, I am over busy right now, can't work on more scripts... also
check how the "NPC" flag is used... because the npc don't harm or recoil and they are kinda "solid"...!?
Ok, I'll check that, thank you very much, enjoy!!!
 

weapon121

Member
Hi,
I just saw your demo, very impressive!
I need a hand to bring it to 4.5.9. Do you know how to set Immune to weapon an No hurt recoil in 4.5.9?
thank you in advance!!
Sorry for not aswering earlier, just saw this! Ive been busy taking care of some stuff at home, so wasn't active for the past couple weeks. I havent had the time to dive into the newer version of nesMaker, just for my byteoff demo which was for the brawler Mod. It should not be that different I would think though, than what I posted previously...
 

Baigomax

New member
Sorry for not aswering earlier, just saw this! Ive been busy taking care of some stuff at home, so wasn't active for the past couple weeks. I havent had the time to dive into the newer version of nesMaker, just for my byteoff demo which was for the brawler Mod. It should not be that different I would think though, than what I posted previously...
Hi Weapon,
Could you please take a look to the code in 4.5? I was not able to make it fully working, I've tried for many many days... thank you in advance, Happy new year!!
 

mouse spirit

Well-known member
dale_coop said the advanced tutorials will help. Atleast I think that's what he was referring to.
But like I said before my (untested in nesmaker) idea was to combine player and platform speed when colliding or when 1 pixel above platform. Also to give this new combined speed a variable and make that players current speed, as to not infinitely loop speed adding.
Because if we just do the first part , the player will get thrown off the platform most likely .
I did this successfully in game maker , a totally different program, so the idea works.
 

puppydrum64

Active member
And how do I pull that off, please? I don't know how to code.

(I should really learn how to code in assembly)
Maybe setting the player's speed to equal the platform's but only during collision, but if you move, jump, or otherwise fall off it goes back to normal
 

Pep31

New member
Based on this tutorial : https://www.nesmakers.com/index.php?threads/moving-bouncing-platform-ver-4-1-5.5616/
I managed to get something kind of working (some polishing still needed) with the ArcadePlatformer module (v4.5.9).

This is what I've done :

In doHandleObjectCollisions

After +isNotPlayerNPCCol

Code:
                            ;;;;;;;;;;;;;;;;;;;;;;;;;;add this for "platform monster"
                            LDA Object_type,x  ;; Is it a platform?
                            CMP #18                ;;replace this number with the number for your platform monster
                            BEQ +isMovingPlatform
                                JMP +isNotMovingPlatform
                            +isMovingPlatform
                                JSR getOtherColBox
                                JSR doCompareBoundingBoxes
                                BEQ +skipCollision
                                    JMP +standOnP
                                   
                                    ;JMP +done
                            +isNotMovingPlatform

And, at the end of the file
Code:
    JMP +theEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;
+standOnP
        LDY selfObject
        LDA Object_direction,x
        STA Object_direction,y
        LDA Object_y_hi,x
        SEC
        SBC #$08
        STA Object_y_hi,y
        STA yHold_hi
       
        LDA Object_h_speed_hi,x
        STA Object_h_speed_hi,y
        LDA Object_h_speed_lo,x
        SEC
        SBC #$1F
        STA Object_h_speed_lo,y
       
        LDA gamepad
        AND #%00000001
        BEQ +
            LDA #$09
            STA temp
            LDA #$03
            STA temp1
            JMP ++
        +
        LDA #$00
        STA temp
        STA temp1
        ++
       
        LDA temp
        EOR #$FF
        STA Object_v_speed_lo,y
        LDA temp1
        EOR #$FF
        STA Object_v_speed_hi,y

        PLA
        TAY
        PLA
        TAX
       
        ReturnBank  
+theEnd
 

CamdenTown

New member
Hi, I am new to NESmaker and I am trying to add this routine to version 4.5.9 for the Arcade Style Platformer module. I have created a monster and added the code but the platform kills the player when they collide.

Apologies in advance if this is a really obvious question but in the following line of code

CMP #18 ;;replace this number with the number for your platform monster

Do I just change CMP #18 to CMP #2 if my new monster is the second one I have created?

Is there anything else I need to amend?

Is there anything I need to amend in the object details?

Thanks in advance
 

dale_coop

Moderator
Staff member
the monster object ID start from #16...
#16 is the 1st monster you created in your Monster List
#17 is the 2nd monster you created in your Monster List
etc..

(Game Objects list have the #00 to #15 object ID)
 
Top Bottom