m4nbarep1g's Recent Forum Activity

  • Ah yes, fair enough. Sorry, I didn't think about that, I'll see if I can set up an example version like that, thanks.

    I have managed to get around this in the meantime, by using a separate sprite, pinned to the sprite that's moving, to pin the text to, that way the bit under the text isn't moving. But, I'd still be curious to know if this issue was caused by something I was doing or not.

  • Hi,

    Construct newbie here, only been using it about 3-4 weeks. I've been working on a card game, basically a Hearthstone clone with spaceships, and it's coming along quite nicely now, except I've come across something a bit strange recently.

    I have an event that shows a larger version of any card when the cursor hovers over a card sprite

    However, it seems that when this event triggers, it affects the pinning of some text objects attached to other card sprites. Normally this wouldn't be an issue as the cards don't move around much, but while cards are ready to attack they are set to a sine movement on the Z elevation. So while this event is active the text object seems to be going in and out of visibility, almost as if they're going behind the sprite. Then when the event ends, the text stays either visible or not depending on the point that the event ends.

    Having tried disabling different parts of the event to see what might be causing it, it seems to be when I choose to pick the top instance of the Deck sprite (the sprite used for both cards in hand and active), but I can't see why picking the top instance out of one group of sprites, would affect the pinning (at least I think it's the pinning that it's affecting) of a text object to another instance of the same sprite? It also seems to only happen when the cursor is over multiple sprites.

    If anyone has any thoughts it would be greatly appreciated, thanks!

    Here's my full project file as well

    https://drive.google.com/open?id=1qvSbR8jQXyWze24yN4ecDrb9JqZrVHHI

  • Thanks AllanR, I should have said, there is a separate event on the ps-incoming sheet, which responds to a message from a peer to add a card, and in that case sets PlayeNo to 2 (as its only a 2 player game). This function isn't working correctly on the host side either though...

    The thing I find strange is that I am sure it's arranging the cards on the x axis correctly, which is the action before move to top of layer, but it just doesn't seem to be them moving it to the top of the layer?

  • Hi,

    I've created a function in my game to arrange a bunch of sprites, representing cards, into a column, laying them out so each is on top of the other going down the screen. I'm sure I had it working some time ago, but since I've been sorting out some other issues it would appear I've changed something so now it's not working. but I can't figure out for the life of me why!

    within the function, it selects sprites based on a variable (set before calling the function), then runs a for each loop ordered by another variable. The actions within the for each loop are to set the sprites to a position based on a formula using the loopindex, and then to move the sprite to the top of the layer. The positioning part is working perfectly, so if a card with a lower value is added, it is put in the appropriate place in the column, but it doesn't seem to be rearranging the Z order, it's just leaving them in the order that they were created. I know this should work as I have an almost identical function, used on another layout, that is working properly, and as I said, I'm sure this one was working properly before!

    Here's my files. the function is called ArrangeDeck and is on the PS-Deckbuilder sheet. The action to call the function is a few events above it.

    https://drive.google.com/open?id=10mHyAhLwODt9EVSjARu3T0AZY4wAc9dc

    Any help would be much appreciated, thanks!

  • OK, actually, I've just run it again, and the client seems to now always be receiving their starting hand, but the host is definitely only receiving the extra card and thruster when the client readies first, but I really can't see why this would be???

  • OK, so I've gone back and tried this another way, by not syncing the object for the cards, and instead creating and destroying them independently on the host and client side. This was how I originally thought to do it, but after doing some reading, I got concerned that all objects should be being created by the host. Then I realised that this only applies if you're using sync object (at least I think that's right) so this is presumably the better way to do it, it you want the players to control the setup of the cards on screen individually? Please correct me if not.

    Anyway, having gone back to doing it without sync, I am instead using arrays to store some information about which cards are where, and sending instance variables back and forth with messages for the rest of the information about the cards. I've managed to get the card select working, but I'm now running into some issues when loading into the main layout for the game. It seems to be an issue around the timing of certain messages being sent from host to client and back again, as the outcome varies depending on if the host or client sends a ready message first.

    If the host readies first, the game loads and both players are dealt a 4 card hand, as is supposed to happen, but if it is then the hosts turn first the host is dealt 2 extra cards, instead of one as it is supposed to, and and receives and extra thruster (a global variable which is basically my version of mana from hearthstone, etc) the same even triggers both actions and is set to trigger once if global variable PlayerTurn=0

    If the client readies first, the game starts, but they receive no starting hand, however, the host doesn't receive an extra card and thruster.

    Here's my latest project file, I've started a new event sheet for the main layout, keeping the old one for the functions I'd already created on it, so everything relating to my issues is on the sheets PS-MainNew, PS-Functions, PS-Outgoing and PS-Incoming.

    https://drive.google.com/open?id=1pPICKz9-akfGD2UbfKyEIJHTegAHEjei

    If anyone's able to point me in the right direction, I'd be very grateful. Every time I think I'm getting my head around multiplayer, it throws another curve ball at me!

  • Hi,

    I'm working on a multiplayer card game, basically a Hearthstone clone, so I can get my head around the general construct to build something more complex later.

    Being completely new to Construct, and game design in general, I built the game with a very simple AI first, and I'm now going back and adding in multiplayer (and realising that was a perhaps not the best idea) but I'm falling down at a very early hurdle.

    I've built a card select screen, which you land on after logging in. on this screen, I need to create a variable amount on instances of my Deck object, which displays the cards, set several variables to each, being pulled from an array based on the animation frame of each card, and arrange them on the screen to be selected (there is more to do after that, but it's this early I'm falling down.

    The host creates the objects by looping through the array with the stats and creating an object for each entry, I then have a series of actions set to run on every tick that rearranges the cards based on a formula using the loopindex and ordering by animation frame. This all works perfectly on the host machine, but I am not getting the right result on the peer.

    I have it set up as such:

    On start of layout > sync Deck and necessary variables

    Signalling server login stuff

    On Signalling joined room > AJAX: request Cards.json

    On "Cards" Complete > array: load from ajax.last data

    create cards, etc

    I know everything up to here is working as it is working on the host. Then:

    On peer connect > function to broadcast message with cards array as .json

    On message received > array:load from message & send message back that array has loaded

    On message received > broadcast message back to peer

    On message received > events to assign animation frame to cards on peer machine

    It seems to be on this last step that it falls down. I've added some bits of text to try to help me debug and I've discovered a few things that are puzzling to me. Firstly, on the peer machine the count of instances of the cards shows 1 more than on the host (I didn't think that could happen with the object synced?), next, as part of the reaction to the last message the peer receives, I added a for each loop on the card object and told it to append a text field with what should be the animation frame (stored as a variable, synced from the host) of each card, and despite my count saying there were 22 instances, the loop only returned two figures?

    I am very confused??

    Here's my files (although apologies in advance for the mess, as I said I'm learning as I go, and trying to retro fit multiplayer to something I'd already built)

    Everything I've described above is on event sheets PS-DeckBuilder, PS-Outgoing, & PS-Incoming

    https://drive.google.com/open?id=1N3aNkzdxVEp8sbw3bFCHMjrgDQ_Gkyof

  • As far as card games go, you can check out my tuts on youtube for a flying start.

    Creating solitaire : youtu.be/E1zqEGLeCyI

    Creating a multiplayer card game : youtu.be/BpnkIL7XvvA

    cheers

    Thanks I'll check them out!

  • You are off to a great start!

    what is happening is that the drag and drop knows which instance of Deck is being dropped, but in your function "CardPlayed" it has no idea which card was just dropped so it defaults to the first card UID which is not in the player's hand. You need to either pass in the UID of the card dropped as a parameter or set a global variable that contains the UID of the last card played.

    Thank you!!! This worked, and as soon as I read it, I understood completely... I've even done this already with another function (I obviously did that very late at night and forgot) although I did it with a global variable, I like the idea of using a param instead, I think that would be a bit cleaner.

    And thanks, I couldn't have done any of this without the help of this forum. It seems like a great community and I'm excited to learn more :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, I'm new to construct (have only been using it a few days) and have decided to embark on what is probably a far too complicated project for learning with, but oh well, I like the challenge!

    I'm basically trying to build a Hearthstone clone so I can learn the basics of creating a card game like this to make a much more complicated version later. I've found several very useful threads on this forum already that have helped me find a way to create and "shuffle" a deck using an array, then deal out cards to the player and add them to a "hand" using another array and referencing animation frames for the different cards. I've even managed to assign stats to the cards using another array and a .json file.

    What I'm currently having trouble with is removing a card from the players hand when it is played (drag-dropped) I came up with a solution for this, which worked in an initial trial I did in another project file, but in the current project it doesn't seem to be working the same?!

    When the card is generated I'm adding the UID of the sprite to an array using the push back action, and that is working fine, I can see in debug. I then have the following event and action set up

    On: Deck - Drag/Drop-Drop > Call Function CardPlayed

    On: Function - CardPlayed >

    arPlayerHand: For each x element >

    arPlayerHand: Current value = Deck.UID > arPlayerHand Delete index Self.CurX from X axis

    The strangest thing for me is that this was working fine in another project, setup almost identically, but when I copied it over, it doesn't work. I can see that it is calling the function as I added another action to check, but it seems to fail at the "current value=Deck.UID" stage, even though I can see in debug that the UID of the sprite I'm moving is present in the arPlayerHand array at the time.

    Huge thanks in advance if anyone can help shed some light on this.

    Here's my construct file if it helps

    https://drive.google.com/open?id=13nHjP0UpggkOQFW28XajEPb4n9dlUCjc

m4nbarep1g's avatar

m4nbarep1g

Member since 3 Jun, 2020

None one is following m4nbarep1g yet!

Trophy Case

  • 4-Year Club
  • Email Verified

Progress

5/44
How to earn trophies