Browse Search Popular Register Upload Rules User list Login:
Search:
(help with script needed) Gunpowder

Image:
screenshot of the scene

Author: Temmie

Group: Default

Filesize: 28.03 kB

Date added: 2024-11-17

Rating: 5

Downloads: 367

Views: 154

Comments: 5

Ratings: 1

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

How to stop extra fire from appearing? I tried doing "pos = pos", but the script copies itself and crashes the game
Please log in to rate this scene
edit
Similar scenes
Title: gunpowder gun beta
Rating: 1.25
Filesize: 198.35 kB
Downloads: 610
Comments: 0
Ratings: 4
Date added: 2008/09/17 17:27:25
Made with: Phun
Rating: rated 1.3
download
Title: Mounted Minigun (PHUN ONLY)
Rating: 5.8889
Filesize: 57.57 kB
Downloads: 2266
Comments: 13
Ratings: 3
Date added: 2009/11/29 06:22:18
Made with: Phun
Rating: rated 5.9
download
Title: MUSKET
Rating: 5
Filesize: 187.1 kB
Downloads: 6036
Comments: 0
Ratings: 2
Date added: 2022/04/27 20:30:40
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: easy gunpowder pistol
Rating: 5
Filesize: 95.45 kB
Downloads: 1488
Comments: 1
Ratings: 1
Date added: 2024/12/25 14:48:48
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Bullet prototype v2 (Gunpowder)
Rating: 5.3334
Filesize: 41.23 kB
Downloads: 989
Comments: 7
Ratings: 6
Date added: 2009/12/05 09:29:18
Made with: Phun
Rating: rated 5.3
download
Title: Working Gunpowder
Rating: 5
Filesize: 204.38 kB
Downloads: 1589
Comments: 3
Ratings: 1
Date added: 2022/04/06 13:58:02
Made with: Algodoo v2.1.0
Rating: rated 5
download
alrigh ive tried alot of stuff and nothing really worked so i just suggest maybe putting a small killer object at where it spawns
@Temmie -- The reason why those red circles spawn where they do is because you do not tell Algodoo where to spawn the circles, and so it automatically defaults to pos[0.0,0.0]. You can make the circles spawn at the point of collisions by adding pos := e.pos to the script. The actual script should look like the following:

(e)=>{
e.other.materialName == "fire" ? {
scene.addCircle({
radius = 0.3;
colorHSVA = [1, 1, 1, 1];
timeToLive = 0.4;
pos := e.pos
})
} : {}
}

Warning: The original way that you wrote the script caused the circles to spawn a huge number of red circles that spawned even more circles! That caused computer lag and crashing. So, change the script in each black circle as shown above AND give each one the materialName = "fire". By making these changes the scene will no longer cause lag and/or crashes!
Last edited at 2024/11/17 18:01:28 by Xray
I was going to say something similar to what Xray had to say, but he beat me to it. :lol:

I do want to say though that, from now on, try not to use regular equals signs (=) when defining variables in Scene.addObject scripts.
In my experience, this also overwrites that variable for the object spawning the other object.

For example, this script, if run inside a circle, will set its radius to 1.0 -- even though you didn't ask it to! :(

Scene.addCircle({
radius = 1.0
})

Even though it's inside of a scene.addCircle script, the = operator is also overwriting the circle's own radius.

Instead, use the := operator.
The := operator always tries to define a new variable if possible rather than redefining an already existing one.

Scene.addCircle({
radius := 1.0
})

This script will not resize the circle being used to spawn the new circle.

I hope this helps! :lol:
Last edited at 2024/11/17 18:08:35 by Little
Very well stated, Little! _o_
Thank you:)