Page 1 of 1

Set Interval only run once

Posted: Mon Nov 04, 2013 7:10 am
by dsteve
Dear All who are using isogenic engine,

Hi, I am creating a game with a setInterval,
Apparently, the set interval only run once,
whether I put set interval in ClientObject.js

Code: Select all

			
this.interval_id=setInterval(this.work(this.produce_interval),1000);
		},
		
		work: function(produce_interval){
			console.log("berhasil");
		}
or in
client.js,

Code: Select all

									case BUILDING_TYPE.STADIUM:
										tempItem = ige.client.createTemporaryItem('Stadium') // SkyScraper, Electricals etc
											.opacity(0.7);
										tempItem.interval_id=setInterval(tempItem.work(tempItem.produce_interval),1000);
									break; 
It still only run once by the engine,
Am I missing something?


Best Regards,
Steven

Re: Set Interval only run once

Posted: Mon Nov 04, 2013 7:18 am
by coolbloke1324
Set interval is not "run by the engine", it's a javascript native method. Have you checked your console log for errors?

Dont forget we have moved to a new forum http://www.isogenicengine.com/forum

Re: Set Interval only run once

Posted: Mon Nov 04, 2013 7:42 am
by dsteve
Dear Rob,

Thank you very much for answering my question, I have moved the thread to your new forum(it looks awesome),
But there is no error,

Best regards,
Steven