hi i am building a tower defence game but i need a to make it so when the live are 0 the game ends . you start out with 20 lives and so i want to make it so when the lives reach 0 the game ends and takes me to another layout.
I also want to make it so when the currency is lower than 20 you cant build towers. right now if you press on anywhere where you are allowed to place a turret you can place infinte turrets. The money logic and the when i build a turret my money gets less i have alredy made and it works.
Thanks pls pls help it would be very helpful
Those things can be done by adding some conditions to check if lives=0 and such.
Look at this tutorial, it will help you get the concept down.
https://www.scirra.com/tutorials/37/beg ... onstruct-2
hi thanks for answering , i read the whole tutorial but i still cant understand what exactly to use for the game to check if lives = 0 if so take me to gameover layout so i really dont know what condition to use .hi i am building a tower defence game but i need a to make it so when the live are 0 the game ends . you start out with 20 lives and so i want to make it so when the lives reach 0 the game ends and takes me to another layout. pls help
You will need to create a global variable by right clicking the layout and selecting create global variable. Call it PlayerLives or whatever you like. Now on the main event sheet create an event using system icon (the gear) and choose "compare variable" selecting the variable you created above and selecting "is less than or equal to 0". Now create an action off that event that also uses system event (the gear) and select action "go to layout" and choose your end layout.
Here's something I whipped up fast. Didn't have time to comment it but it's pretty obvious. Could do with a bit of uncluttering, but my head isn't there today
UP / DOWN arrow keys = increase / decrease player lives
right click mouse = add 10 to money
Develop games in your browser. Powerful, performant & highly capable.
Thank you very much guys I made it work thanks again