How to make a function

how do i create a function?

Functions can be easy to use after knowing how to use them, here, this might help:

thats what i did
it doesnt work

Try this, I tested it just today, so it should work.

window.setTimeout(Somefunction, 1000);

function Somefunction() {
alert( “it worked” );
}

what does it do?

after a second after being on a frame, it sends an alert

(the function is to send an alert)

heres my function
function move (angle, speed) {
this.x += Math.sin(angle/57.3) * speed
this.y += Math.cos(angle/57.3) * speed
}
did i do something wrong?

what does an alert do

type this in the default script to find out:

window.alert("hello");

oh
thats cool

is my function wrong?

so what do i use?

Here’s just an example.

function example10-8-2020_3-20-49PM.wick (1.7 KB)

my computer crashed when i tried to inset it

i don’t know then, it’s fine for me.

maybe something else happened

it works now
but i cant use this. i have to use player.
player is the name of object

feel free to just change the names, it’s just an example.