Mouse Controlled Gun - Help Needed!

For topics that don't fit under the other topics or forums.

Mouse Controlled Gun - Help Needed!

Postby Dare » Thu Aug 26, 2010 11:49 am

Building a mouse controlled gun turret, but I have a big problem. Every time the laser hits the box to spawn the bullet, its collideset and colour are changed! This means that the laser no longer hits the box and makes bullets.

I have no idea how to fix this, does anyone else have this problem or can help?

[scene]45636[/scene]

E to fire.
ImageImage
TC42 wrote:Dare, you are creepy.

Official Algobox Admin! Please PM me if you have any issues regarding Algobox.
User avatar
Dare
 
Posts: 833
Joined: Sat Nov 21, 2009 4:27 pm
Location: Sydney, Australia

Re: Mouse Controlled Gun - Help Needed!

Postby Mystery » Thu Aug 26, 2010 12:40 pm

Easy fix.

You made the mistake of writing = instead of := in the spawn code.
= Mean to change an existing variable
:= Means to create a variable

scene.addbox({
pos = e.pos;
size = [0.2, 0.07];
color = [1.0, 0.9, 0.0, 1.0];
collideset = 8;
drawborder = true;
restitution = 0.5;
friction = 0.0;
vel := (e.normal * (20))
})

Algodoo reads the highlighted text as "change collideset to 8", since the only collideset variable the laser sees is the laser's it will try and change that one instead.

scene.addbox({
pos := e.pos;
size := [0.2, 0.07];
color := [1.0, 0.9, 0.0, 1.0];
collideset := 8;
drawborder := true;
restitution := 0.5;
friction := 0.0;
vel := (e.normal * (20))
})
Now algodoo will read the highlighted text as "create collideset that equal 8"


Also with the laser change maxrays to 1, and i recommend making the bullets either change rotation to fit the angle of the shot or to simply be circle. Good luck.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Mouse Controlled Gun - Help Needed!

Postby Dare » Thu Aug 26, 2010 11:57 pm

Cool, thanks a lot!
ImageImage
TC42 wrote:Dare, you are creepy.

Official Algobox Admin! Please PM me if you have any issues regarding Algobox.
User avatar
Dare
 
Posts: 833
Joined: Sat Nov 21, 2009 4:27 pm
Location: Sydney, Australia


Return to Algodoo in general

Who is online

Users browsing this forum: No registered users and 5 guests