How do I Create multiplayer classes

Get help using Construct 2

Post » Fri Sep 04, 2015 10:46 am

Spent so much time on this, I cant even think anymore so it might be a simple solution.

I have a multiplayer 1v1 fighter game.

Before going from 'Login' Layout to 'Game' layout, the player chooses class1 or class2, it is then set to a global variable 'Class'. 1 or 2.

How can i use the variable to change the animation for the character sprite? With the correct animations displayed on the Host and Peer's screen for each character.

Ive tried loads of stuff and my mind is boggled. Any help or alternative suggestions would be Amazing. Thanks. (Not able to post Capx yet sorry)
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Fri Sep 04, 2015 1:00 pm

Do you have a none multiplayer model working with displaying the correct animations ?

If so, post a capx or explain the mechanics, and I'll try to assist :)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Fri Sep 04, 2015 2:12 pm

Nah i dont at the moment man sorry.

What ive been trying is this and similar...


- Gave sprite Variable 'Class'

- Sync the variable 8 bit

- For the peer.

If Global Variable 'Class' = 1 > Setbit(Self.Class, 1, 1)
If Global Variable 'Class' = 2 > Setbit(Self.Class, 2, 1)
Set client input state "Class" to Sprite.Class

- For the Host.

If Variable 'Player_Name' = Multiplayer.MyID > Set Sprite Variable 'Class' to Global 'Class'
If Variable 'Player_Name' Is Not = Multiplayer.MyID > Getbit(Sprite.Class, 1) = 1 > Set 'Class' to 1
If Variable 'Player_Name' Is Not = Multiplayer.MyID > Getbit(Sprite.Class, 2) = 1 > Set 'Class' to 2

- Common.

If 'Class' = 1 > Set Animation to 'Class1'
If 'Class' = 2 > Set Animation to 'Class2'




Please Forgive me for my abomination of an explanation, i know... its laughable ^^. I have 0 coding experience and just a few weeks with this program.

If you have an email address and a little spare time, i can send you my project so you can see for yourself. Id be happy to help with any graphic work in exchange :)
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Fri Sep 04, 2015 2:14 pm

Some wacky stuff is happening, hard to explain lol
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Fri Sep 04, 2015 7:48 pm

Hah, no worries :)

Looking at what you want, it seems you would be better off using a one time action instead of a continuous sync of state.

Something like

-host:

event
On button press select class
action
set animation class
broad cast message 'classinfo' : MyId &"|"&class


-peer

event
On button press select class
action
set animation class
send message to host 'classinfo' : MyId &"|"&class


-common

event
on peer message 'classinfo'
pick all peer
pick peer by evaluating peer.peerid = tokenat(Multiplayer.Message, 0,"|")
action
set peer animation = tokenat(Multiplayer.Message, 1,"|")
sub is host // if host receives, broadcasts to the rest
action broad cast message 'classinfo' : multiplayer.message
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Sat Sep 05, 2015 2:26 am

Thanks dude. Ill give it a go!
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Sat Sep 05, 2015 5:50 am

Sorted! Thanks for the input, it helped me out a lot. If you ever want some graphics doing gimme a message.
B
9
S
3
Posts: 104
Reputation: 1,033


Return to How do I....?

Who is online

Users browsing this forum: evillair, lordsas, Matei511, tarek2 and 62 guests