Match 2 sprites and destroy(Solved)

This forum is currently in read-only mode.
0 favourites
From the Asset Store
snake and ladder game with two characters: turtle and rabbit!
  • Here I've done another example using an Array as I explained.

    Thanks my friend, gonn'a try and decipher it!

    Will get back to you.

  • ROJOhound,

    Your example works if i pick 2 matching 'CARDS'.

    But if i select a card, then select one that isn't a match to the first one, everything resets and previously matched cards are wiped out?

  • Here I've done another example using an Array as I explained.

    Thanks for your help with this, it works but i don't fully understand how!

    Can this method be simplified to work without the array ?

    For example, the 'picture sprites' are simply given a pv of 1 to 4

    (which is the animation frame number) and then covered with a card.

    Here's your original cap with my blocks added-

    Magistross cap2

    Thanks in advance.

  • ROJOhound,

    Your example works if i pick 2 matching 'CARDS'.

    But if i select a card, then select one that isn't a match to the first one, everything resets and previously matched cards are wiped out?

    I misunderstood step 4 in your first post.

    Here is a corrected cap where only the mismatched cards are reset.

    http://dl.dropbox.com/u/5426011/examples5/cardmatch2.cap

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks ROJOhound, works perfectly now. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Thanks ROJOhound, works perfectly now. <img src="smileys/smiley4.gif" border="0" align="middle" />

    I am trying to incorporate your solution into my cap, and for some reason i can't get it to work.

    Couple of questions:

    Event 3

       + cover: Opacity Equal to 10

       + System: CountMatching(cover.OID) Equal to 2

    What exactly does the second line of event 3 do. Iv'e not seen this expression before ?

    Is the group 'playing' active at start?

    Sorry for the million questions, but i need to sort this.

    Cheers

    <img src="smileys/smiley9.gif" border="0" align="middle" />

  • OID is object id, a specific number given to each different type of object.

    In this case its the object cover.

    So basically is saying if object cover's opacity is equal to 10, and if the number of the objects called cover placed into the selected objects list is 2... do stuff.

    Not to be confused with UID, a specific value assigned to each individual instance of an object.

  • OID is object id, a specific number given to each different type of object.

    In this case its the object cover.

    So basically is saying if object cover's opacity is equal to 10, and if the number of the objects called cover placed into the selected objects list is 2... do stuff.

    Not to be confused with UID, a specific value assigned to each individual instance of an object.

    Thanks for the info newt, this part makes sense now.

    -------------------------------------------------------

    ROJOhound wrote:

    "Here is a corrected cap where only the mismatched cards are reset.

    http://dl.dropbox.com/u/5426011/examples5/cardmatch2.cap"

    I transfered the events to my cap, and it works, as far as making the 2 cards 10% opaque.

    If you have a spare bit of time, heres my cap, with yours added at the end.

    (run it, and press keyboard 2 to activate the memory match bit)

    nightmare

  • I got it working:

    http://dl.dropbox.com/u/5426011/fixed/chrisbrob.cap

    10% opacity was not working so I switched it to 25%.

  • I got it working:

    http://dl.dropbox.com/u/5426011/fixed/chrisbrob.cap

    10% opacity was not working so I switched it to 25%.

    WOW....i am truly amazed ROJOhound !

    I was just about to put the project in my 'Can't be done' folder and you come up a solution?

    Amazing considering there's about a million groups in the cap.

    Thank's for all your help.

  • ROJOhound

    Thanks for your previous help with the above.

    I am trying to recreate the events, but instead of using the transparency as a trigger i want to use a card (or cover) with 2 animations 'facedown' and 'faceup'(obviously this is the card that covers the blocks).

    Ive been trying to work this out for 2 days, but it just wont work.

    If you get a minute, would you have a look at it.

    This link is a screenshot of the current events (the original)

    Solution

    I havent bothered including the events i have tried because its a bit of a mess!

    Thanks in advance. <img src="smileys/smiley9.gif" border="0" align="middle">

  • I did this once using a "flipping" technique.

    +>pv selected is equal to 2

    ->sprite set width to lerp(.width,.orginalwidth-.orginalwidth, 1-0.5^timedelta)

    +>pv selected is equal to 1

    ->sprite set width to lerp(.width,.orginalwidth, 1-0.5^timedelta)

    +>sprite compare width >0 sprite set animation frame to 1

    +>sprite compare width <0 sprite set animation frame to 2

  • Thanks for the example newt, thats a good method for the 'flipping' of the card, the problem im having is replacing the events that depend on the Transparency factors.

    I thinks it because the 'card' and 'block' are in a container? which i haven't used before. <img src="smileys/smiley5.gif" border="0" align="middle" />

  • chrisbrobs,

    There are a lot of changes needed to make it work. My approach would be to scrap the events I gave you before and start anew.

    Here is an updated example.

    Layout 1 is just basic matching, but I think is pretty jarring.

    Layout 2 has smooth card transitions which is more visually pleasing.

    http://dl.dropbox.com/u/5426011/examples5/match.cap

  • There ya go. Add some sound effects, a few particles, and some randomization, and you got a nice little game.

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