[Help] Collision Change Script

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

[Help] Collision Change Script

Postby InsertNameHere » Thu Feb 12, 2015 4:49 am

I've been searching around for a thyme script where a laser hits a geometry/object and it multiplies the collision set number by 2. Basically each time the laser hits the number increases like this, 1, 2, 4, 8, 16, 32, etc. Can anyone help me figure out the script/ let me copy past it? I'm going to need the script for a thing i'm working on! The script also needs a limiter in itself where when it comes to a certain number it stops increasing.
Epic
User avatar
InsertNameHere
 
Posts: 60
Joined: Tue May 27, 2014 11:31 pm
Location: Claremore Oklahoma

Re: [Help] Collision Change Script

Postby Kilinich » Thu Feb 12, 2015 12:00 pm

onLaserHit = (e) = {collideSet = clamp(collideSet * 2, 0, 512)}
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: [Help] Collision Change Script

Postby InsertNameHere » Thu Feb 12, 2015 6:22 pm

cool thanks this will be helpful to me dude :)
EDIT: Using this script just changes the LASERS script and not the circle and the collide set only changes 1 time...? :|
Epic
User avatar
InsertNameHere
 
Posts: 60
Joined: Tue May 27, 2014 11:31 pm
Location: Claremore Oklahoma

Re: [Help] Collision Change Script

Postby Willt125 » Tue May 26, 2015 10:21 pm

How about using onLaserHit to change any object, unless specified, to helium?
Willt125
 
Posts: 2
Joined: Tue May 26, 2015 10:13 pm

Re: [Help] Collision Change Script

Postby FRA32 » Sat Aug 08, 2015 5:41 pm

The code is:

onLaserHit =(e)=>{e.geom.collideSet = clamp(e.geom.collideSet * 2, 0, 512)}



onLaserHit - the laserhit event

(e)=>{} - the method

e.geom.collideset = - setting the collideset of the geometry that was registered by the event

= clamp() - limiting the value to 0 and 512 so it wont exceed these

e.geom.collideset * 2 - doubling the collision number of the object

This should work
FRA32
 
Posts: 229
Joined: Wed Dec 03, 2014 9:51 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests

cron