Announcement

User registrations are currently disabled due to high spam traffic.

#1 21/07/08 5:53pm

lilmb
Serious Addict
From: Latvia
Registered: 22/06/08
Posts: 305

Switching players

So, i have this question:
Is it possible to switch players like from one player to another. Like first moving with tank and then with helicopter? Or from unit to unit. Like in strategy games.
On liveswif or flash mx 2004!
Thanks for ANY help! smile

Last edited by lilmb (21/07/08 7:37pm)

Offline

 

#2 21/07/08 7:46pm

69corvette
That one guy.
From: Not Palmdale, CA
Registered: 01/02/08
Posts: 280

Re: Switching players

No offense but most of the questions on this forum about programming are "give me code to do this" questions.
Really, programming is about problem solving.  It seems people don't even try...
This is an obscure question, because it's implementation will vary.
EVERYTHING IS POSSIBLE.  THIS IS NOT SOMETHING COMPLICATED.
If something seems so hard for you should first start somewhere simple.


[img]http://img221.imageshack.us/img221/8990/smallersigcopylb1.jpg[/img]

Offline

 

#3 21/07/08 7:57pm

lilmb
Serious Addict
From: Latvia
Registered: 22/06/08
Posts: 305

Re: Switching players

Ok, i will try to solve it, but could you give me clue?

Offline

 

#4 22/07/08 1:23am

crimsonhotsun
Hardcore Member
Registered: 30/03/08
Posts: 96

Re: Switching players

Here's a clue. Flash allows you to turn a variable into an object reference, and reference different objects.

Code:

button1.onPress=function(){
    ref=mc1;
}
button2.onPress=function(){
    ref=mc2;
}
mc1.onEnterFrame=function(){
    if(Key.isDown(39)){
        ref._x+=2;
    }
    if(Key.isDown(37)){
        ref._x-=2;
    }
}

mc1 and mc2 are different movie clips, and button1 and button2 are different buttons. Code goes on the stage.

Last edited by crimsonhotsun (22/07/08 2:24am)


[img]http://img101.imageshack.us/img101/9094/20707804nc6.png[/img]

My humble forums: [url=http://hologram.zxq.net/forums/]VirtualWorldForums[/url]

Offline

 

#5 22/07/08 7:46am

lilmb
Serious Addict
From: Latvia
Registered: 22/06/08
Posts: 305

Re: Switching players

Great thanks! smile I will try.

Offline

 

#6 22/07/08 8:20am

tenjimaru
Moderator
From: SD-CA
Registered: 30/03/08
Posts: 679

Re: Switching players

I think, I have anotherway to do this... I still have to test it, though...
i'll let you know if it works...


[i]cookie Tenebra Crystallis.. Released!
Portable Fishing 2012 Released!
Find Them In The 'Flash Games' Section of The Forums[/i]

Offline

 

#7 22/07/08 3:06pm

lilmb
Serious Addict
From: Latvia
Registered: 22/06/08
Posts: 305

Re: Switching players

Ok, i will wait! smile

Offline

 

#8 22/07/08 4:08pm

69corvette
That one guy.
From: Not Palmdale, CA
Registered: 01/02/08
Posts: 280

Re: Switching players

CRIMSON!  If these people are going to get better at this they need to do some things on their own!  Eventually for every problem they have, rather than solve it themselves, they will come to the forum!

BTW im not angry, just in case that sounded angry. big_smile


[img]http://img221.imageshack.us/img221/8990/smallersigcopylb1.jpg[/img]

Offline

 

#9 22/07/08 4:28pm

lilmb
Serious Addict
From: Latvia
Registered: 22/06/08
Posts: 305

Re: Switching players

Yeah, that sounded angry! big_smile
I will wait for Crimson's code thinking and making. big_smile

Offline

 

#10 22/07/08 5:00pm

crimsonhotsun
Hardcore Member
Registered: 30/03/08
Posts: 96

Re: Switching players

I know I know, I'm sorry corvette, and it does kind of annoy me too, but I thought I'd just provide a hint. I'll refrain from giving the answer as much as I can but I did at least try to only hint instead of completely answer it.


[img]http://img101.imageshack.us/img101/9094/20707804nc6.png[/img]

My humble forums: [url=http://hologram.zxq.net/forums/]VirtualWorldForums[/url]

Offline

 

#11 22/07/08 6:22pm

nothing
Moderator
Registered: 21/03/08
Posts: 389

Re: Switching players

Wow, for this I don't even use specific script. I just make different players in a single MC and use buttons to switch between parts of the MC with _root.player.gotoAndPlay(4); if the static sprite of my player is on 4. Stuff like that.


[url=http://pspflashgaming.com/forum/viewtopic.php?id=1078]BioShock[/url] PSP|fPS-Factor Released|[url=http://www.p22server.hostwq.net/index.html]p22 Center[/url]

I'm starting p22 again.

Offline

 

#12 23/07/08 6:39am

lilmb
Serious Addict
From: Latvia
Registered: 22/06/08
Posts: 305

Re: Switching players

Yes, that could work with one player wich is walking then he jump in car. But i have like this:

0000000000
0111111110
0111115110
0141111110
0111211310
0000000000

0 - wall; 1 - floor; 2 - soldier; 3 - tank; 4 - heli; 5 - jeep

So i have to switch to totally different sprites!

Offline

 

#13 23/07/08 6:50am

Alpha009
Edge
From: new york
Registered: 03/02/08
Posts: 1117

Re: Switching players

ask ashnard,sothe,volke,shinon,ranulf,rolf,or ike.they shjould know.

Offline

 

#14 23/07/08 7:54am

lilmb
Serious Addict
From: Latvia
Registered: 22/06/08
Posts: 305

Re: Switching players

it is joke, right? smile

Offline

 

#15 23/07/08 8:10am

nothing
Moderator
Registered: 21/03/08
Posts: 389

Re: Switching players

Yesm, a joke.

have the car, name it "car" (instance name)
and put this on it:

Code:

if(this.hitTest(_root.player)){
  _root.player.gotoAndPlay(6);
}

Now on the player's MC, make the car image and put "stop();" all on frame 6 of the MC.

Now 69, i didn't give the full thing, but I did hint him on what to use and how to integrate it. Now, he has to figure out in what sense to use it, and what the hell it means.

Last edited by nothing (23/07/08 8:10am)


[url=http://pspflashgaming.com/forum/viewtopic.php?id=1078]BioShock[/url] PSP|fPS-Factor Released|[url=http://www.p22server.hostwq.net/index.html]p22 Center[/url]

I'm starting p22 again.

Offline

 

#16 23/07/08 9:14am

lilmb
Serious Addict
From: Latvia
Registered: 22/06/08
Posts: 305

Re: Switching players

I now what it means very well! If player touch car he "get in" it.

Ok, now I get how to do it! BIG Thanks everyone!!! smile

If i will have problems, i will try to solve them, but if i can't i will post here.

Offline

 

#17 23/07/08 2:03pm

nothing
Moderator
Registered: 21/03/08
Posts: 389

Re: Switching players

Glad I could help.


[url=http://pspflashgaming.com/forum/viewtopic.php?id=1078]BioShock[/url] PSP|fPS-Factor Released|[url=http://www.p22server.hostwq.net/index.html]p22 Center[/url]

I'm starting p22 again.

Offline

 

#18 23/07/08 4:11pm

Alpha009
Edge
From: new york
Registered: 03/02/08
Posts: 1117

Re: Switching players

your not supposed t-WATS WRONG WITH YOU! CORVETTE SAID NOT TO TELL EM
















































sorry

Offline

 

#19 23/07/08 4:47pm

nothing
Moderator
Registered: 21/03/08
Posts: 389

Re: Switching players

YEah, but he still has to figure out HOW to use  it.


[url=http://pspflashgaming.com/forum/viewtopic.php?id=1078]BioShock[/url] PSP|fPS-Factor Released|[url=http://www.p22server.hostwq.net/index.html]p22 Center[/url]

I'm starting p22 again.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson