Hey Guys,
I’m having a hard time implementing a laser beam for my latest game. Basically I have a object (Beam Platform) and then the laser as
laserBeam = display.newLine( 240,180, 240,200 )
laserBeam:setColor( 255, 0, 0, 255 )
physics.addBody( laserBeam, "static", { density=0.0, bounce=0, friction=0.0} )
Now what I’m trying to achieve is that the player needs to cut the beam by placing another static object in-front of the beam to allow the player past.
When the “Block” or “SteelPlatform” cuts the beam the beam is suppose to stop at the “Block” or “SteelPlatform”.
No as they are 2 static objects collisions don’t seem to work as they don’t trigger the event.
I cant make one of them dynamic as I don’t want either of them to move
Can this be done another way? eg - via Sensors or via detecting the breaking point of the line?
here is the code that I currently have setup
[code]
laser1 = display.newImageRect( “images/laserGun.png”, 15, 15 )
laser1.x = 240 ; laser1.y = 150
laser1.rotation = 90
laser1.myName = “laser”
physics.addBody( laser1, “static”, { density=5.0, bounce=0, friction=0.5} )
levelGroup:insert( laser1 )
laserBeam = display.newLine( 240,180, 240,200 )
laserBeam:setColor( 255, 0, 0, 255 )
physics.addBody( laserBeam, “static”, { density=0.0, bounce=0, friction=0.0} )
[/code] [import]uid: 40417 topic_id: 11148 reply_id: 311148[/import]