Breaking Down the Script Menu - Scripting Events || Algodoo Marble Race Scripting Tutorial
HTML-код
- Опубликовано: 25 авг 2024
- Make sure to watch in HD so that you can actually read the scripts lol.
Hello everyone!
This is the going to be first of many videos that will focus on scripting! I will be uploading a series of videos that will hopefully help you better understand scripting as a whole, but more importantly, help you apply them not only in your marble races, but also in your overall Algodoo experience.
This video focuses on the events Algodoo supports - events like onClick, onCollide, onDie, onHitbyLaser, onKey, onSpawn, postStep, update, and onLaserHit.
Want marble racing? Check out my channel!
www.youtube.co....
Subscribe so you don't miss a thing!
www.youtube.co....
Algodoo Wiki
algodoo.fandom...
Made using a program called Algodoo
Recorded using OBS
Edited using Windows Movie Maker
Music:
Laszlo - Fall To Light | • Laszlo - Fall To Light...
Lost Sky - Where We Started | • Lost Sky - Where We St...
Tobu - Candyland | • Video
Timestamps!
onLaserHit: 0:40*
onClick: 0:47
onCollide: 1:35
onDie: 2:15
onHitByLaser: 3:20
onKey: 3:54
onSpawn: 4:41
postStep: 6:11
update: 6:55
* = not demonstrated in this video
put one more time stamp and name it intro and set it to 0:00 so that its in your video
Nice tutorial! A way for the viewers to read the scripts better is if you increase the menu scale in the settings.
Also, congrats on (almost) 4K subs!
Was going to suggest that. I wish there was a shortcut for it.
Hello! Thanks for the suggestion! I didn't actually know about this, so I will look into it!
Thanks for doing this. Scripting is my biggest weakness!!
May I suggest you add some timestamps for each section in your pinned comment or in the description. I think it's now possible to do it within the video, although haven't tried it yet.
Thank you so much! I enjoy your work and hope that the series can help you as it progresses! Also for your suggestion - that is a good one; I'll work on it!
Onkey script:
keys.isdown("x") ? {} : {}
x is the key you want to press.
Also this is great!
did you mean
Keys.isDown("x") ? {//Do } {//Else }
?
Awesome! I never knew the change color code! That’s awesome! I can’t wait for you next video!
I'm new to the channel I subbed and liked and ringed the bell
1:00
no, they aren't per-cent-ages, they're per-unit-ages.
Awesome video! Your video has helped many people! :)
how do i run more than one script on these triggers?
How do i make bullets in algodoo?
It would helped if you displayed the scripts you were writing in another box with a bigger font the way you did for the narration
in what time?
Can I make more than one counter? I suck at coding so idk
can't see the code clearly!! but its great
AMAZING!!! love it
cool! I will watch the rest later, I saw to 6:46
Good video ur the best :D
Como Se Podría Mover Un Motor Con Una Scrip
How can I move the circle left and right with the arrow keys?
2:36
and u kno u can copy the color in script menu, change it to a dif color, then paste it
Thanks. I need to improve a lot.
could you make a video about the onLaserHit event please
btw, what is the script for the test subject button?
I can't write more that one string in OnCollide. Algodoo not allows. What to do?
you do: (insert first script);
(insert second script)
Hi Jumpy! All the replies are right - all lines of code must be separated with a semicolon. Hope it helps!
Thanks so much! It works!
How to get it on ipad
it helps a lot with my races 😍😍😍
Can you write da code pls? I cannot see
To the onKey-event. It really could be. Thyme looks quite similar to Java. And the KeyListener from that has three events: keyTyped (which triggers only once) but also keyPressed and keyReleased which I think both are combined here. Perhaps there is a way to differentiate this. I don't know.
And for sure, the onKey-event is for any key in the first place. You would have to tell the event, for which key he should do something.
How i can do this? I want to press “a” for sonething and press “p” for other thing
@@cristianserrano8390
That is easy: The KeyListener has gotten the keys, which is pressed. So, when you press any key, the Listener goes active. You ask him, if the "a" is pressed and if yes, send it on that way. If it don't, you ask, if the "p" is pressed and if yes. send it the other way. if a different key is pressed (i.e "z") then the KeyListener does nothing after the questions.
@@HalfEye79 Yes, this is JavaScript
@@cristianserrano8390
I don't know JavaScript. That was Java. (Not related!)
Hey i found out its been 2 years and you have not posted on how to spawn things with code, can u please make tutorial.? this wont get replied lol
PLZ TELL ME HOW 2 SPAWN A TEST SUBJECT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
hello there i know i should ask you and should watch the tutorial but i really need an script super fast pls help me with it so lets move on: i want a script that when you push a key on your keyboard it spawns a pre selected object pls give the script to me thats a lot
I just figured out how to do the test subject thing. Except how to spawn it at a certain position. Every time I try to do it, the button teleports there too. I guess I’ll find out in your next tutorials!
Maybe you have "pos = (enter position)" in your code. Try to add a semicolon like this:
pos := (enter position)
Hope this works!
If you mean type:
pos := [x,y]
Then I already did that. It teleports the pad along with spawning the marble there. But thanks for helping anyways! :)
@@BootifulBlaze if the marble has the teleport code, remove the code, which leaves only the teleporter to have the code
When u gonn do another fmr race
the code goes away i think it is because of the advanced users only thing how do i fix??
Do you make sure to add semicolons after every line of code?
@@seth2rock oof thanks for the advice
Teleporter: onCollide: e.other.pos = scene.my.var1 postStep: scene.my.var1 = pos Spawner: postStep: scene.my.var1 = pos
Me: *watches the video*
Also Me: *goes on algodoo and copies the steps*
Can’t do it D:
Can you put the scripts in the description?
how do u spawn a test subject
i confused
:c
plz tell meh
how do u define the counter
AWNSER MEEE
Pwease
@@MrMymy-hw5ik postStep=(e)=>{text=“”+scene.my.count}
5:05
6:50
I need an answer now. I used the pack, when I use the Anti gravity and the "anti" anti gravity, it won't work!!
I don't know which pack you used, but maybe I can help. Can you send the scripts both pads have? Thanks!
@seth2rock I forgot the pack's name, but here are the scripts:
Normal:
(e)=>{
e.other.density = 2;
e.other.radius = 0.25;
e.other.postStep == (e)=>{vel = vel + [0, 0.32]
} ? {
e.other.postStep = (e)=>{}
} : {}
}
Anti Grav:
(e)=>{
e.other.postStep = (e)=>
{vel = vel + [0, 0.32]
}
}
@@ok.3400 I still can't find the issue, but here's some things you can try:
-Make sure both those scripts are in the onCollide box
-I don't see why the density and radius scripts are necessary, even the if-statement to detect the postStep. Try changing the onCollide of the normalizing pad to
(e)=>{
e.other.postStep = (e)=>{}
}
and see if it helps.
Hope to hear from you!
Its the 'rainbow' marble kit..
Btw it works thanks!
ik im late to this vid but i dont under stand this part 2:43
Thank you so must UwU:D
3 scammers at this video! Beware seth2rock!
2:47