control 2 characters with one mouse?[S]

Started by Icey, Thu 17/03/2011 01:05:41

Previous topic - Next topic

Icey

Is it possible to control 2 characters with one mouse?

Eggie

Yes.

There are plenty of different things that your question could mean but I am 100% sure that they are all possible.

Icey

So does anyone have any idea on how to do this?

Ghost

If you want to have two characters on the screen, and a mouse click on some location must move both of them, the simplest way is to make one character follow the other. There's a command for that.

And that answer actually was more precise than your question. What exactly do you want to do?

Icey

Well I didn't really want to say the main reason cause I thought no one would help me. However I will tell you.

I might be planing to make a stereoscopic 3d game again. I want to have one chr on one side of the screen mean while I want a different character on the other side of the screen with the same view. If I can figure out that I can start the game but until then I dont think so.

Ghost

Ah, okay then. One way (of many) would be to have a second character and change his position in repeatedly_execute, using the main character's position as
a reference:

cPlayer2.X = player.X+100;
cPlayer2.Y = player.Y;

That would "sync" the two characters, always keeping cPlayer2 100 pixels RIGHT of the player. If that is a solution you can use?

Icey

Thanks. Now when I start the game it should be real easy now that thats out of the way. :)


zabnat

Just a note, if your characters walk, you probably also want to "sync" the animation frames. You can do this by having identical loops on each character and then setting the frame and loop of the second character in the repeatedly_execute to match the first character.

Icey


mode7

Well i could post that - but can't you look it up in the help file, like i have to do?

Frame property (character)
(Formerly known as character[].frame, which is now obsolete)

int Character.Frame

Gets/sets the character's current frame number. Usually you won't change this directly, but will use the Animate command to play an animation.
Example:

Display("EGO currently using frame %d.", cEgo.Frame);

displays EGO's current frame number within his view.

You'd have to make sure - both have the same loop and view
You can do that automatically with some coding

However...
You could just run all you normal animate and lock view functions twice for both characters and make the first one non blocking . could work too.


SMF spam blocked by CleanTalk