If it's not changing

About advanced scenes, and the Thyme scripting language used in Algodoo.

If it's not changing

Postby Rideg » Mon Jun 07, 2010 7:08 pm

Hello I want to make a defensive canon that shoots down a nuke missile. The missile updates a variable called "scene.my.nukePos". When the missile gets shot down or explodes before the canon shoots it down it should stop update the "scene.my.nukePos".

Here's my problem: I want the canon to notice that the nuke is not moving ( wich means detonated or shot down ) and stop shooting and return to normal angle.

Simplified: How would I go around making a script that detects when a position isn't changing after 1 second?
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: If it's not changing

Postby Kilinich » Mon Jun 07, 2010 8:35 pm

why don't just add scene.my.nukeActive = true variable and set it to false on explosion?
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: If it's not changing

Postby Rideg » Mon Jun 07, 2010 11:04 pm

Oh, didn't think of that thank you. But now I'm curious if there's a way to make a "if it's not changing" method. :?:
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: If it's not changing

Postby Dakta » Mon Jun 07, 2010 11:12 pm

^^ 'Nuff said.

Otherwise:

Check the current value against a stored version of the last value, and have a conditional (if statement, if you must) to check if it is the same. If it is, set Scene.my.nukeActive to false, or do whatever.
.. ,__,_____
. / __.==--" - - - - - - - - ""
./#(-'
.`-' From http://www.ascii-art.de/. Modded by me to work in Arial. Image
a Mammoth wrote:be boring and interesting.

Mystery wrote:If you were jailbreaker you shouldn't have when't up the 3.1.3
I didn't know you could go up 3.1.3! Thanks Mystery person!
User avatar
Dakta
 
Posts: 417
Joined: Sat Sep 12, 2009 4:36 pm

Re: If it's not changing

Postby Rideg » Tue Jun 08, 2010 3:29 pm

ok cool thanks :thumbup:
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 10 guests

cron