[4.1] Switching between Player and another Object (test)

dale_coop said:
Hmmm... I think this code should work in every modules.
Electric cat, could you explain what is your issue exacly (what's happening in your case) also share the script you are using?

Im using the code that you have posted up. Works just fine in the platform module. I set it up the same way in the adventure module doesnt work the same way. When in go to to game objects and it has 00 to 16 the only object I can switch and get a sprite to appear is my player death animation.

I will post up pictures for you maby i missed a step.
 

dale_coop

Moderator
Staff member
Which module are you using? the BASE_Adventure one?

I just did the test (right now) with the BASE_Adventure module... and it works for me (I did the test with my game object 14, the last one).
Check your "OBJ_PLAYER_XTRA" constant value, the object you use for that extra player object should be set like you would do for your player.
Make sure you use the same script without any modification (or if you modified it, could you share your script?).
 
dale_coop said:
Which module are you using? the BASE_Adventure one?

I just did the test (right now) with the BASE_Adventure module... and it works for me (I did the test with my game object 14, the last one).
Check your "OBJ_PLAYER_XTRA" constant value, the object you use for that extra player object should be set like you would do for your player.
Make sure you use the same script without any modification (or if you modified it, could you share your script?).

Alright I will take a look at it set it up the way you suggest and then if it doesn't work then I will share all my screenshots with you
 

red moon

Member
Hello,
I am starting the process for attempting this and wanted to see how it works with the other graphics banks for monsters. Since my player sheet is fairly packed full, I will need to use a monster object from bank 1 (bank 0 is full) and I wanted to see if using something from bank 1 would cause an issue while playing on screens with monsters from bank 0?
Also, is it possible to duplicate the setting from the player object to a monster object or do the animations have to be assigned manually, I ask because its all the same animations and placement of sprites.

thanks Dale!
I think this is the last bug thing for the Beast demo and then its ready to play!
 

Attachments

  • startingplayer.jpg
    startingplayer.jpg
    900.2 KB · Views: 4,040
  • switchplayerr.jpg
    switchplayerr.jpg
    913.8 KB · Views: 4,040

dale_coop

Moderator
Staff member
The "simple" object switch of that example requires that the object is loadable on the screen (basically, if you can make a monster object and place him on the screen, it's a object you can switch to)... here it looks like your "second" character will use almost all the tileset... remains nothing for any other monster, right?
If you can't fit your second character object in your gameobjectsTileset or in ALL your monster tilesets, it will not be possible that way. (What you need is something more complex).
:(
 

red moon

Member
Thanks for getting back to me so quickly. And that makes sense so I would need to approach it another manner. Is there a way to have two player objects in the game object list? I am using the same 2 palettes between both player options and all pickups so it would not require unique palettes at least...
 

dale_coop

Moderator
Staff member
Yes, you can have 2 (or even more) player objects in your game objects... as long as all the needed graphics fit in the GameObjectsTileset.bmp (because the game objects use that tileset).
 

red moon

Member
I see. Hmm...

One solution is to simply break the demo into 2 sections.

I could have you play as the starting character then put up a message to load the next .nes file to play the remainder as the Bloodbeast. You will not be able to toggle back the starting character at that point, but you would gain the benefits of playing in that form.

Thanks for your input as always, Dale!
 

Dirk

Member
OMG! Why am I finding this thread only now? This is truly awesome Dale Coop!
I'll use this in a later stage of my game, I think.
Thank you!
 

dale_coop

Moderator
Staff member
HAha, thanks...
It's KUBO, the main character of my son's NES games.
So... I will tell to my boy ;)
 

m8si

Active member
Is this possible in version 4.5?
I tried and I get Unknown Label Error on playerToSpawn and CreateObject. How to fix this?
 

dale_coop

Moderator
Staff member
That script is not compatible as it... you will have to adapt it for the 4.5
To be honest, the 4.5 is just a beta, a companion code module for the Summer Camp tutorials... it's not the definitive version (that will come just after that Camp).
I would prefer wait for that final version before making/porting those old scripts to the 4.5 to be sure that everything is still correct/relevant.
 
I made a simple script, that can with the Player with another Object (Game Object or Monster Object)... just a test for fun (has a lot of
Issues).

[media]
]View: https://youtu.be/wqWQHZAgeyg[/media]


1/ Add a new "User Constant" in the "Script Settings > User Constants" tab, name it "OBJ_PLAYER_XTRA" and give it the value of the object index you want to use for your Player to switch to, for this example, I used "14".
But HERE, you can change to any object index you want to use to with! (monster objects start from 16).


2/ Make a script named for example "SwithPlayerToXtraObject.asm", with this code:

Code:
;; change character to OBJ_PLAYER_XTRA
switchPlayerXTRA:
    LDX player1_object
    LDA Object_x_hi,x
    STA newX
    LDA Object_y_hi,x
    STA newY
    DeactivateCurrentObject
   
    LDA playerToSpawn
    BEQ goSwitchingPlayerXTRA   
    ;; put back tehe initial player object
    LDA #$00
    JMP continueSwitchingPlayerXTRA
goSwitchingPlayerXTRA:
    ;; we use another one :
    LDA #OBJ_PLAYER_XTRA
continueSwitchingPlayerXTRA:
    STA playerToSpawn

    LDA Object_scroll,x
    STA temp3
    CreateObject newX, newY, playerToSpawn, #$00, temp3  ;;  currentNametable   

    TXA
    STA player1_object
   
    ;PlaySound #SND_TRANSFORM
    RTS


3/ Add this script to your "Input Scripts" and add this script to the "PRESS" "Select" button for example. When you press select it switch the character (more fast one, or invincible one, ...)!

Voilà, it's just a small test script, do whatever you want with it.

In fact, I would not recommend to use this script
In your great game, because it’s full of bug ;)

Need to work more on that before being useable.
You are very good Dale! It would be possible to use it as an item, or, turn into a flying bat for example?
 
Top Bottom