Need help with swapping between player objects

MistSonata

Moderator
So, one of the problems I'm dealing with right now is that while I've got the movement down to what I'd like it to be, the limit on 8 animations means that my player object only has enough animations for all 8 directions when I need 16 (8 directions with the thruster on, 8 with no thruster).

So, since I couldn't figure out how to get the melee weapon and its offset (which I was using to put a thruster flame behind the ship) to show up when the thrusters are on, I'm wondering if the best way would just be to have the B button toggle which object is the player object. I have no idea how to change anything in player1_object.

Anyone have any ideas?
 

RadJunk

Administrator
Staff member
Are you really limited to only 8 animations? You shouldn't be...if you exit out and go back, will it still not let you add anymore?

Here's SORT of an idea for a workaround...see if you follow me here.

Make a custom action type. Since your thruster doesn't need to do anything except be present and follow the player, it would say something like:

Code:
    ;; we'll use Y as the player index
    ;; while x is OUR index.
    LDY player1_object ;
    LDA Object_x_hi,y ;; player's x value
    STA Object_x_hi,x ;; set it to my x value
    LDA Object_y_hi,y ;; player's y value
    STA Object_y_hi,x ;; set it to my x value

Now, if you run that with a SUPER short timer, or maybe with an animation timer that is quick that repeats that action, it should effectively trail the player.

The you have it destroy itself if a button is released, and have the player create it if a button is pressed.

So that's a simple way to make it always appear at the top left corner of the player (at his 0,0 point).

From there, you'll just have to start massaging the code with this sort of logic....

Code:
    ;; we'll use Y as the player index
    ;; while x is OUR index.
    LDY player1_object ;
    LDA Object_x_hi,y ;; player's x value
    clc
    ADC #$01 ;;; some number...this would add 1 to the player's position to store to the thruster horizontal position, for instance.
    STA Object_x_hi,x ;; set it to my x value
    LDA Object_y_hi,y ;; player's y value
    clc
    ADC #$05 ;; some number...this would add 5 to the player's position to store to the thrusters vertical position.
    STA Object_y_hi,x ;; set it to my x value

And then you'd just have to append the code to make cases for each direction.
Code:
  ;; while x is OUR index.
    LDY player1_object ;
   LDA Object_movement,y ;; the player's movement
   AND #%00000111 ;; the actual direction
   CMP .... whatever direction you're looking for.....
   BNE notThatDirection
   ;;;; it is that direction.
   ;;;set up the offset for that direction.
   JMP toALabelBeyondThisCode
notThatDirection:
   CMP ....a different direction.....
   BNE notThatDirectionEither...
   ;;;it IS that second direction
   ;;; set up offset for THAT second direction
   JMP toALabelBeyondThisCode
   ...
   ...
   ...
 toALabelBeyondThisCode:
   RTS

This is really crappily written just to start putting ideas in your head. For NOW this would be a way that should *kind of* work
 

dale_coop

Moderator
Staff member
Wow, love that kind of post! Very interesting.
This is why the forum is 100 times more fun than a Facebook page... :)
 

RadJunk

Administrator
Staff member
By the way, this is BY FAR not the best way to do this thing and may look a little wonky, because every other frame it will lag just a bit i think. BUT...this is the fun puzzle-solving that can allow NESmaker to do lots of different things, even in its current state!

When the offset / parenting scheme is working as it should, this will be SUPER easy to handle. It's coming eventually. :)
 
Top Bottom