scripting to spawn a spawning object

Discuss things about Phun that don't fit into the other forums.

scripting to spawn a spawning object

Postby monkeymasha » Fri Jan 21, 2011 6:59 pm

im still using the origional phun, and i hav been trying to think of a way of applying a specific oncollide script to an object. I want the object that is spawned to hav its own oncollide script that will spawn a third object when it collides with something. is this even possible? and if it is, could someone plz give the basic script for this. much appreciated :)
monkeymasha
 
Posts: 2
Joined: Fri Jan 21, 2011 6:34 pm

Re: scripting to spawn a spawning object

Postby Kilinich » Fri Jan 21, 2011 11:20 pm

Sure, just add onCollide := (e) => {your script} in spawning object.
More than that, RaRaMalum use once a great script for "life" game, where he give same on collide to child from parent:
Code: Select all
(e) => {
    scene.addCircle({
        ...
        onCollide := e.this.onCollide;
        ...
    })
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: scripting to spawn a spawning object

Postby monkeymasha » Sat Jan 22, 2011 12:03 am

thank you, i just didn't know how to imput the script. :D and thanks for recommending RaRaMalum, that is exactly what i was trying to do. cheers again.
monkeymasha
 
Posts: 2
Joined: Fri Jan 21, 2011 6:34 pm


Return to Phun Edition in general

Who is online

Users browsing this forum: No registered users and 5 guests

cron