Script that adds money every 4 seconds after placing an object

M

Monter

Guest
Hello, I'm working on a tower defence game. Starting money is set to 200. Except towers I want to build mines that gain 25 gold every 4 seconds. I have no idea how to write a script for this.
 

Walky

Member
One possible way to do this is to create a 4 seconds Alarm event that adds 25 gold and then calls itself.
 

FrostyCat

Member
Blindly copying code off tutorials is a sin for coders. If you paid attention to how you did rate of fire for your towers, you shouldn't need to ask for this.

Your towers should have code setting an alarm or a manual countdown variable, and firing and resetting the alarm/countdown when the interval elapses. This is no different, except the interval is 4*room_speed and the action is adding 25 to gold.
 
Top