Eliminate last frame used

0 favourites
  • 9 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • Hi I have a problem at a card game.At dealing i made set animation frame at Random(0,Card.AnimationFrameCount),but the frames are repeating idk why.

    Its like I draw the 1st 5 cards and some are copies like 2Q or 2Ace that are exactly the same heart or leaf ..... and I don't wanna have that in my hand coz the deck has no copies idk how to eliminate frame after the card with that frame its drawn pls help or tell me a way to draw cards without duplicates.

    Happy New Year 2014!!!!!!!!!!!!!!

  • Hi,

    i haven't worked with array in construct yet, but how about pushing the drawn cards frame number into an array and in your condition Random(0,Card.AnimationFrameCount) add a second condition for "not - array contains value"

    happy new year

  • Seems that my game its messed up .I'm newbie I tried to make the deck and so with array but idk how to place a frame into an array and so.Seems like array can help me as it has a pop option to eliminate one element .I think i can use that like random placing frames or sprites in the array the draw the from card from array with pop fron after that.

    I need some help with the array, if some1 can explain how to make that I would be really GRATEFUL.

  • You may want to use choose system expression instead.

    choose(1,2,4,5) picks a random number from the list, excluding the 3. You just need to fill the parameters by listing animation frames excluding the current one.

  • still waiting for tips! Expression choose(1,2,4) excluding current frame doesn't work it still duplicates 1,2 or 4 .I'm trying to do something to exclude frame 1,2,4 after its chosen, drawn.It choose one of those numbers,but it can choose the same number many times I want the same number to be chosen only once so it can't duplicate.

  • Anyway Thx for tips Mipey and 5Type.

  • Ah, right, you want a set of unique numbers. Here is a tutorial for that:

    Generating Random Numbers Without Duplicates

    Not very elegant solution in my taste, but it should do you well. What I normally use is a Fischer-Yates shuffle method (google it), as demonstrated here:

    <img src="https://dl.dropboxusercontent.com/u/629300/Images/shuffle.png" border="0">

    I just iterate through the function results and draw the frames in supplied order.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • THX A LOT MIPEY !!!!!!!!!!!! <img src="smileys/smiley20.gif" border="0" align="middle" /> <img src="smileys/smiley42.gif" border="0" align="middle" />

  • Happy new year :)

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