Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / random sprite

Author
Message
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 5th Feb 2012 18:45
im making a card game and i would like it so that when the cards are delt the hand is always different. i have placed all the sprites in 1 place and i thought would there be a way for me to get them to be randomly selected befor moving the the designated area, all the cards are diffeerent pictures and names so would it work?

sorry for all the questions i ask but im new to coding

kirtnicholls
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th Feb 2012 21:09
lets say you have 50 cards in your deck.

make an array of 50 elements.
maybe a loop. in this loop you would randomly pick 2 elements of the array, and swap them. the bigger the loop the more randomly cards are mixed.

Login to post a reply

Server time is: 2024-11-23 00:57:24
Your offset time is: 2024-11-23 00:57:24