Multiple Character Game Object switching

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.
Post Reply
Raftronaut
Posts: 3
Joined: Mon Sep 03, 2018 4:47 pm

Multiple Character Game Object switching

Post by Raftronaut » Thu Sep 27, 2018 5:06 pm

Hoping to get some advice as to how I can achieve character switching in the adventure module.

I have a specific need to have 4 switchable characters in my adventure game. I have my initial player set up and the remaining 3 player characters set up in the monster banks ready to go . However, I am entirely uncertain how I would go about actually switching the player object Persistent tag from one character to the other.

Obviously this would require some custom ASM code, but hoping I could accomplish this by using the select button to change character states.

Could anyone here recommend where I should get started in order to solve this?

I am still a bit foggy regarding the scripts as well, once some custom ASM code like this is written it can be imported as a module script
Correct? I would assume this would be helpful to others that would require separate character states for their designs as well, I.E. charcter powerups, or costume changes etc...


This is my first post to the forum, please let me know if I am directing my questions to the correct area!!!!
:roll:
Knietfeld
Posts: 4
Joined: Fri Oct 05, 2018 1:48 pm

Re: Multiple Character Game Object switching

Post by Knietfeld » Fri Oct 05, 2018 3:06 pm

I just came across your post last night. It's been a while since you posted, did you figure anything out yet?
I tried to create a complete solution for you but I barely got started on it when my baby woke up and that was the end of that. I have some ideas though, and hopefully can work on it more tonight. I was able to replace my player character with another object but I couldn't make the new one move yet. You specifically mentioned the persistent tag and that, which is stored in the ObjectFlags variable, should be pretty simple to copy over into the new object's variable if we need to.
Anyway, I'm mostly just letting you know someone is trying to figure this out for you. I wish I could have done more already. It seems like a fun problem to solve and I've been trying to figure out a similar problem for my game. I've been coding in asm for a couple years now, but I'm still learning how nesmaker's code is all laid out and where I can plug stuff in to make it do what I want.

This is also my first post to this forum... My first post to any forum, I think. I don't know if it's in the right spot, but it makes sense to me.
User avatar
Nz17
Posts: 2
Joined: Sat Oct 06, 2018 7:19 am
Location: A Cold Place in America
Contact:

Re: Multiple Character Game Object switching

Post by Nz17 » Sat Oct 06, 2018 7:24 am

I would also like to switch among multiple playable characters a la The Lost Vikings. Any help is appreciated!
Raftronaut
Posts: 3
Joined: Mon Sep 03, 2018 4:47 pm

Re: Multiple Character Game Object switching

Post by Raftronaut » Mon Oct 08, 2018 10:28 pm

Knietfeld wrote:
Fri Oct 05, 2018 3:06 pm
I just came across your post last night. It's been a while since you posted, did you figure anything out yet?
I tried to create a complete solution for you but I barely got started on it when my baby woke up and that was the end of that. I have some ideas though, and hopefully can work on it more tonight. I was able to replace my player character with another object but I couldn't make the new one move yet. You specifically mentioned the persistent tag and that, which is stored in the ObjectFlags variable, should be pretty simple to copy over into the new object's variable if we need to.
Anyway, I'm mostly just letting you know someone is trying to figure this out for you. I wish I could have done more already. It seems like a fun problem to solve and I've been trying to figure out a similar problem for my game. I've been coding in asm for a couple years now, but I'm still learning how nesmaker's code is all laid out and where I can plug stuff in to make it do what I want.

This is also my first post to this forum... My first post to any forum, I think. I don't know if it's in the right spot, but it makes sense to me.

HI Knietfeld! I appreciate your response and interest! I have not solved the problem as of yet. Although I did get some clues from JOE today on the facebook forum earlier today. According to him, the solution to having multiple character states is as follows:

1) Understand how to create and destroy objects...like when the player turns into the "death" version of the player.
2) Understand how the variable player1_object works.

this is what i'll be focusing on tinkering with on my next nesmaker session, hopefully I will learn some things with trial and error. Once I come up with some answers I will be sure to post them here as I am sure others will find it helpful. This could be a very good way to handle player upgrades, vehicles, costume changes, power ups ETC...
Knietfeld
Posts: 4
Joined: Fri Oct 05, 2018 1:48 pm

Re: Multiple Character Game Object switching

Post by Knietfeld » Tue Oct 09, 2018 1:06 pm

Yep, those are exactly the things I was playing with. I used the handle player death script as a base and switched some things around so the player character is destroyed first then the new object is created. Since the createobject macro just searches for the first available spot to place the new object, it places the new object in the player object's recently vacated place. This lets you control the new objects left and right movement (I've been using the platformer module, in the adventure module it may let you control other directions) but the action states don't change. So I was trying to figure out more about all the parts of code that affect player1_object, and what I can do to control or change it. Anyway, good luck! I'll keep toying with it too and let you know what I figure out.
Raftronaut
Posts: 3
Joined: Mon Sep 03, 2018 4:47 pm

Re: Multiple Character Game Object switching

Post by Raftronaut » Sat Oct 13, 2018 5:51 am

Could you post the script you're working with?

I found the handle player death script, but I am confused to a few things, wondering where my variables should be
Post Reply