How do I Create multiplayer classes

0 favourites
  • 7 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • 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)

  • 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

  • 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

  • Some wacky stuff is happening, hard to explain lol

  • 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

  • Thanks dude. Ill give it a go!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorted! Thanks for the input, it helped me out a lot. If you ever want some graphics doing gimme a message.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)