[SOLVED]Spawn circle that has inherited variables
3 posts • Page 1 of 1
[SOLVED]Spawn circle that has inherited variables
I couldn't figure out how to word the title any better, but here's what I'm trying to do: I have a laser that spawns a circle on the point that it hits, for use in an engine. I need to have the circle inherit the velocity of the object that the laser is attached to, because the speed of the engine is severely limited by this (Lets say I have a car traveling at 15 m/s, but it can't go any faster because it has to accelerate the circles being spawned in the engine up to that speed.) I know this is really easy using scene variables, but I would prefer not to use them because it makes having multiple cylinders a massive hassle.
Last edited by HQTG1 on Mon Jul 10, 2017 11:00 pm, edited 1 time in total.
-
HQTG1 - Posts: 2
- Joined: Thu Nov 03, 2016 5:12 am
Re: Spawn circle that has inherited variables
Just add set vel (and angvel if needed) of circles:
In onLaserHit:
In onLaserHit:
- Code: Select all
(e) => {
scene.addCirclre({
pos := e.pos;
vel := e.geom.vel;
angvel := e.geom.angvel;
...
})
}
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Spawn circle that has inherited variables
First, before creating the object, get an instance of the object the laser is attached to:
base := scene.entitybygeomid((readable(owner)).geom);
then simply call its vel
scene.addCircle({
...
vel := base.vel
...
})
base := scene.entitybygeomid((readable(owner)).geom);
then simply call its vel
scene.addCircle({
...
vel := base.vel
...
})
- FRA32
- Posts: 229
- Joined: Wed Dec 03, 2014 9:51 pm
3 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 8 guests