Tuesday, June 12, 2018

Construct 2 - One Trick Everyday #14 - Random images show with no repeat

Hi All,

If you like the trick please tap on few ads, it will help me continue my work.

I am back with Season 2 of my series 'Construct 2 - One Trick Everyday'. Today gonna share a new trick for showing images with no repeat. I am sure many of you would have tried generated random no. and mapped an image to show accordingly but it always repeat the same image or no. instantly. Forexample, instead of showing series 1,3,5,4,7 construct 2 would have shown randomly 1,3,3,4,5,5. I faced this issue many time and thought can share it with all my friends here. Steps follows like this

1. Create sprite with as many frames as you want. I took sprite with no. 1,2,3,4,5. You can see that in video.
2. Create local variable. 
3. Assign it to sprite.animationframe
4. Add a while loop, with add another condition local variable = sprite.animationframe. Basically we are telling loop to generate random no. if we find new number and previously generated number was same. If not then generate new number or show new image.

I know reading is very difficult and sometimes difficult to understand too so you can see my video of the solution here https://youtu.be/b2EwQS7RfSM


Also you can download capx from here


Tags:


Construct 2, construct 2 tutorial, construct 2 game, construct 2 tricks, game, game development, learn game development, 2d game development, 2d game creator, 3d game creator, hell bullet, bullet, image scale, zoom, learn construct 2, water, create water, water in 2d, create rain, rain in construct 2, rain effect, rain in game, fog in game, create fog in construct 2, construct 2 fog, create smoke in construct 2, construct 2 smoke, construct 2 thunder, thunder, create thunder in construct 2, create lightning in construct 2, lightning, thunder sound, create thunder in 2d game, laser, create laser, Scirra, Scirra Construct 2, tutorial, Construct 2, Scirra tutorial, Scirra Laser, Scirra Laser effect, Laser Effect, Simple Laser Effect, Simple, Construct 2 laser, Scirra Effect, Laser,construct 2, admob, intel xdk, monetize, monetization, intel, ads, construct 2 tutorial, scirra, beginner, guide, redfoc, redfoc tutorial, cocoonjs, cocoonio, cocoon, export, build, tutorial, export to android, export to iphone, export to ipad, cordova, export to cordova, mobile, html5, multi platfrom, game, construct 2 game, admob ads, cocoonads, cocoon ads, cocoon plugin, compile, compiler, admob tutorial, add admob, admob construct 2

No comments:

Post a Comment