Browse Search Popular Register Upload Rules User list Login:
Search:
press numbers with laser segments

Image:
screenshot of the scene

Author: UnityDogGaming04

Group: Default

Filesize: 4.87 kB

Date added: 2019-10-05

Rating: 5.4

Downloads: 1443

Views: 256

Comments: 11

Ratings: 2

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

yes lasers
new decimal point
idk might make a 5x7 or 5x9 seg
k bai
Last edited at 2019/10/06 23:18:54 by UnityDogGaming04
Please log in to rate this scene
edit
Similar scenes
Title: alien ship (read desc)
Rating: 5
Filesize: 249.48 kB
Downloads: 431
Comments: 1
Ratings: 1
Date added: 2018/01/20 17:46:34
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Laser Numbers
Rating: 7
Filesize: 11.45 kB
Downloads: 1491
Comments: 8
Ratings: 6
Date added: 2012/01/22 22:58:07
Made with: Algodoo v2.0.2 Edu
Rating: rated 7
download
Title: 7 segments LED(read desc)
Rating: 5
Filesize: 7.02 kB
Downloads: 851
Comments: 4
Ratings: 1
Date added: 2013/06/02 02:31:36
Made with: Algodoo v2.0.1
Rating: rated 5
download
Title: Party Rave Laser
Rating: 5
Filesize: 23.93 kB
Downloads: 353
Comments: 0
Ratings: 1
Date added: 2011/06/02 01:36:48
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: Special Laser Cutting Platform
Rating: 5
Filesize: 16.78 kB
Downloads: 2650
Comments: 0
Ratings: 1
Date added: 2011/02/22 13:21:36
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: 606 Megawatt Laser
Rating: 5
Filesize: 400.74 kB
Downloads: 643
Comments: 1
Ratings: 1
Date added: 2013/12/05 20:40:23
Made with: Algodoo v2.1.0
Rating: rated 5
download
This could be done with only one laser for each of the seven segments. The Thyme script is a little more complex, but the segments do not flicker when a number key is held down like they do with using multiple lasers. Let me know if you are interested, and I will show you an example script for one laser. You can then easily figure out the scripts for the six other lasers.
Well I do like chllenges.
Hit me lol
Okay, here is what you need to do:
Put just one laser on each of the seven segments. I will show the script for the center horizontal segment because it gets activated by a lot of number keys. This is the script that goes in the "onKey" event of the laser for the center segment:

keys.isDown("2") || keys.isDown("3") || keys.isDown("4") || keys.isDown("5") || keys.isDown("6") || keys.isDown("8") || keys.isDown("9") ? {
maxRays = 1
} : {
maxRays = 0
}


The script above converted into words is this: If 2 key is pressed, OR if 3 key is pressed, OR if 4 key is pressed
, OR if 5 key is pressed, OR if 6 key is pressed, OR if 8 key is pressed, OR if 9 key is pressed, Set "maxRays" to 1. Otherwise if none of those keys is pressed, Set "maxRays" to 0.

When maxRays is 0 (zero), the laser will not shoot out a beam. This is how a laser can be controlled instead of using the normal "activation button" method. So, be sure to disable the activation button for each laser if a button had previously been assigned.

Now in the center horizontal segment you must create a local variable named _timer. You do this by entering the following in the data entery area in the upper left corner of the script menu:
_timer = 0
After you enter that script, you should see the new local variable named _timer in the list of events and variables for that geometry. Then in the "onHitByLaser" event, you enter the following script:

color = e.laser.color;
_timer = 5

That will set the geometry color to the same color as the laser (which happens to be Red), and also it will set the _timer to 5.

Then in the postStep event for the geometry, you enter the following script:
_timer > 0 ? {
_timer = _timer - 1
} : {
color = [0, 0, 0, 1]
}

That script checks to see if the _timer is greater than zero. If it is greater than zero, subtract 1 from it. If it is NOT greater than zero (meaning it is zero) then set the geometry color to black.

The reason why this geometry needs a timer is because we cannot directly detect when a laser is NOT hitting an object. We can only detect when a laser IS hitting an object. So, the way I get around that is by presetting a timer to some arbitrary value (in this case 5) whenever a laser is hitting it. The timer cannot count down to zero as long as a laser is hitting the geometry. But when a laser is NOT hitting it, then the script in the postStep event will be allowed to subtract the timer value down to zero. When zero is detected, then the geometry color returns to black.

You will of course need to adjust the scripts for each of the other lasers.

Have fun!
Last edited at 2019/10/05 17:57:50 by Xray
i see. this is a whole lotta complicated stuff. i noticed as i read that i might be able to simplify this a step further. could i make code such as this and simply put it inside the segment instead of the laser?
(code for the upper left segment)
postStep = (e)=>{
{
keys.isDown("0") || keys.isDown("4") || keys.isDown("5") || keys.isDown("6") ||keys.isDown("8") ||keys.isDown("9")
} ? {
color = [1, 0, 0, 1]

} : {
color = [0, 0, 0, 1]
}
it's been updated
it's AWESOME
maybe ill make a number printer with this design idk
where the code will be put in the lasers and the lasers will move from seg to seg
your method would work on this but the way i made it in the new scene is like at least 3.14159265358979323 times simpler
i know more digitso of pi if you care to hear
3.1415926535897932384626433832795028841971693­99375105
52 digits whatever you get it
Wow! :o
Excellent! :tup: :tup:
Thanks for all the helps, both of u.
one thing i realised is if you look through all my scenes in order you can see the skill i had at the time of the scene's upload slowly but surely go up
just something really interesting
looking at my old scenes gives me nostalgia even tho it wasnt that long ago (maybe 2-4 years?)
With Algodoo (and especially with Thyme script), there are so many different ways to do the same thing. Some ways may be simpler and more efficient, and other ways may be more clever. But it doesn't matter because it all boils down to the fact that people should have fun and learn some things while having fun. That's what it's all about!
**HOKEY POKEY SONG INTENSIFIES**
That's what it's all about......... YES!