Hello, I tried to create a game for two players but not on the same screen, I mean player 1 has a screen with squares that must be hidden for the other, And the same for player 2. Look at the next picture.
I put in my land some objects, I don,t want (he) to see them, because he will guess where they are, and I have his land as empty to guess his objects are where?
Iâm afraid I donât understand. Do both players have a section on the game window that is their âboardâ? Is it multiplayer, between two different devices? Do you want to know how to hide the objects on the right board? What exactly are you asking?
Yes, on Both devices, Both players have their board, I will try to make it multiplayer, I want player 1 to have player 2 board but empty, on my turn in the game I click a square in his empty board on my screen, If this square has a diamond in his board I destroy it, And this diamond appears in this empty board on my screen, If my guess was wrong X sign appears in this square that I clicked, It must appear, So I donât click him again.
I wish I could but I really donât know what or how.
I think he means give a variable to the objects at the beginning of scene. So I think youâd have to put them all in an ObjectGroup in your editor. So what variable to give them because it has to be unique, so that part trips me up. I would try to give them an id of the players name I guess, and later while doing the code I would find an easier solution (you always find better ways to do it as youâre working on it). Anyway at first you can try having the player input their name, changing the text of a scene variable to that input, hiding all items of ObjectGroup at the beginning of scene, then doing a condition like âchange the text of ObjectGroup variable PlayerName set to scene variable PlayerNameâ and then say if ObjectGroup variable PlayerName = Scene variable PlayerName show ObjectGroup.
Iâm not saying that would work because I always have to try stuff first to see if it does work. Also I advise you if there is a part of your game youâre stuck on and you donât know how to do it and arenât getting help, go work on a different part of your game for now. Just let all those objects be visible to everyone and work on other logic in your game. As a game dev you canât panic or give up or waste a lot of time just because you donât know how to do something yet. You just put it a TODO comment in and go about your business developing the rest of your game (or a completely different and easier game if you donât know how to do anything in the game you âwant to makeâ yet haha) and believe me you will soon either figure out the solution yourself or run into your solution in some completely weird and random way.
Well, we canât give any specific guidance if we donât even know how you handle your multiplayer.
If youâre using P2P, thereâs the expression P2P::GetID(). If you set an instance variable to that value, I assume youâll be able to hide or show the instance, depending on the P2P current player ID.