Card Game

0 favourites
  • 12 posts
From the Asset Store
Card Game
$49 USD
Card Game Sound Effects Kit delivers the right variety of sounds to outfit your game.
  • Hi guys,

    I just downloaded construct 2 and it looks really fabulous. However I'm not too sure if it is really designed for what I had in mind. I have already developed a few card games in java/swing and so as a warm up I would like to have a go at this as my first project.

       From what I have seen would I have to crate 52 sprites with each one having its proper set of events which seems to be a bit of a nightmare or is it possible to have just 1 card sprite and to spawn 52 cards with different characteristics i.e. different graphics, instance variables to represent its suit and value etc.

       Secondly would i be able to drag and drop each one of these individually around the screen?

    Cheers for any input.

  • Try making one sprite with 52 animation frames for each card. Set the animation speed to 0, then just use 'set animation frame' to change the card.

  • Sounds like a plan! Thanks for the idea I'll try it out straight away.

  • Ok I tried this out and it worked like a dream however (funny how there is always a but) I did the following little project to test it out so with 1 sprite and 52 animation frames and then when I did a mouse click i would spawn a card incrementally at the mouse location.

    It worked like a charm but something weird happens as i click from about the 10th card onwards the card spawning time grows exponentially longer so by about 15 spawns i'm waiting like a minute to see the card (in chrome) here is the coding: original card sprite is invisible to start off with a global integer called cardNb.

    <Mouse> <On any Click> <Card> Spawn Card on layer 1

                            <Card> set animation speed to 0

                            <Card> set visible

                            <Card> set position to (Mouse.x, Mouse.Y)

                            <Card> set animation frame to cardNb

                            <System> add 1 to cardNb

    Have I coded something wrong or is this just a performance limit and so I could never have 52 cards spawned?

    Regards

  • It's best to post your .capx file for Ashley or someone else to check out (if you don't mind others looking :D).

    I've spawned HUNDREDS of Sprites each with individual actions and private variables and the game still ran fine... so maybe it's just a little glitch somewhere.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ok no problem except what is a .capx file and how do i post it? <img src="smileys/smiley5.gif" border="0" align="middle" />

    cheers

  • .capx is the format of your project when you "Save as a single file" (basicly a .zip of a folder project).

    To post it, check out this tutorial about dropbox.

  • Great I just learnt something new! Ok here is the link if anybody is

    interested:

    dl.dropbox.com/u/47181564/Solitaire.capx

    I disabled the animation frame incrementation so now it basically just

    spawns a king of hearts. When run just click on the green back ground and things should start slowing down around 15ish.

    Cheers

  • I found the problem -- the event that says "Card - Spawn card etc. etc.". If you set text to display the number of cards, you'll see it's actually spawning in powers of two; 2, 4, 8, 16, 32, 64, until it reaches THOUSANDS of cards spawned in the same spot every time you click. Hence the slowdown. <img src="smileys/smiley17.gif" border="0" align="middle" />

    You can fix it by switching out that line for "System - Create Card at Mouse.X, Mouse.Y". Accomplishes the same thing without that messy situation!

  • Wow thank you Mr Sully The Strange! Onward with the adventure!

  • Just one last question is it normal that it spawns in powers of two? <img src="smileys/smiley5.gif" border="0" align="middle" />

  • Just one last question is it normal that it spawns in powers of two? <img src="smileys/smiley5.gif" border="0" align="middle" />

    Probably shouldn't use spawn to create a duplicate. Try the system objects "create object" instead.

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