Hi,
is there any way to generate random size buttons in cocos2d?
random size buttons
(2 posts) (2 voices)-
Posted 8 months ago #
-
Create a button graphic (CCMenuItemSprite*) or (CCMenuItemLabel*) -
Generate a random number using a function like
float randomScale = ((arc4random() % 11)+1) / 10 //(Will give you a value between and including 0.1 and 1)Then apply it to the button once you have created it:
yourButton.scale = randomScale;Posted 8 months ago #
Reply
You must log in to post.