This site requires JavaScript, please enable it in your browser!
Greenfoot back

Comments for Light Beam Class Demo

Return to Light Beam Class Demo

nooby123nooby123

2012/12/26

Thank you so much! This really helps!
A new version of this scenario was uploaded on Wed Dec 26 19:21:04 UTC 2012 An actor class that creates a beam of light within darkness. Follows a light source object. Minor improvements.
A new version of this scenario was uploaded on Wed Dec 26 19:46:54 UTC 2012 An actor class that creates a beam of light within darkness. Follows a light source object. Minor adjustments.
lonely.girllonely.girl

2012/12/26

Hello Danspot Can I ask you if you have any demo about Mario game? thx
A new version of this scenario was uploaded on Sun Dec 30 09:19:10 UTC 2012 Support class giving an actor the ability to emit light. Methods provided to alter beam/darkness.
JetLennitJetLennit

2013/4/24

May I use this for a game?
I'm pretty sure it's ok, considering I've used it in my game...
JetLennitJetLennit

2013/4/24

How do i change it to where the flashlight has a greenish hue?
JetLennitJetLennit

2013/4/24

(or if you are British torch)
JetLennitJetLennit

2013/4/24

And be thinner
Well, to be thinner, you change the range (look at the Beam documentation) And you'll probably have to edit the beam class to make a greenish hue, change the updateImage code to this: [code] // add ambiance to image image.setColor(new Color(/* The RGB values*/, 255-intensity)); image.fill();[/code]
i did this for a blue-green glow: image.setColor(new Color(20, 200, 100, 255-intensity));
JetLennitJetLennit

2013/4/24

Thanks for your help!
no problem
LaurenceLaurence

2016/9/5

Would it be possible for this to follow an actor and point in the direction of the cursor?
danpostdanpost

2016/9/5

@Laurence, if the actor points in the direction of the cursor, then the beam will also. The beam will always follow the "source" actor and point in the same direction that actor faces.
LaurenceLaurence

2016/9/5

public class Lamp extends Actor { int dir = 0; /** * Act - do whatever the Lamp wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { setRotation(90); } } I've made a simple 'lamp' image and indeed it turns 90 degrees but the beam stares straight forward weirdly enough.
danpostdanpost

2016/9/5

@Laurence, start a discussion thread on this. Show your complete world class and Lamp class codes and explain the problem and what the fix should do.
LaurenceLaurence

2016/9/5

Gotcha
A new version of this scenario was uploaded on 2016-12-07 05:02:42 UTC Some "collision" methods added.
A new version of this scenario was uploaded on 2016-12-07 05:03:07 UTC Some "collision" methods added.
A new version of this scenario was uploaded on 2020-10-30 20:04:05 UTC