I remade my star simulator

night sky3-12-2022_17-54-06.html (2.2 MB)
wasd to move
eq to go forward and back

.wick file
night sky3-12-2022_17-53-07.wick (74.4 KB)

2 Likes

It is nice. As a constructive feedback, for this kind of things, Object Oriented Programming (OOP) comes handy. Since you have good math skills, you should learn how to program using OOP methodology.

Here is what I mean…
NightSkyOOP.wick (2.2 KB)

Since there is only one clip on the stage, and the code is only in one place, there is a significant reduction in file size: from 74.4KB to only 2.2KB

1 Like

So you just put all the code in one object?

That is not exactly the best way to describe it. Your code was put into a js class. Here some benefits, there could be more…

Reusability:
With one class now you can instance your stars 200 or 500 times without copy/paste your clips 300 times more…

Maintenance:
If you have 500 stars and you want to add something to the code, you had to either change all the 500 stars, or delete all of them, and then do the change, and then copy and paste them back to the stage 500 times. Now, with Object-Oriented, you only do the change in the class and it is automatically spread.

Organization:
For complex projects, you have all your code in only one place.

Readability:
When you have a code divided into classes, all the classes have a specific purpose for the app, so it is easier to understand and follow.

Performance:
Before, 200 clips had 3 scripts each (Default, Keypress, update). So Wick Editor had to schedule 600 hundreds of different instances of the same script. Now, with this approach, Only 2 scripts were scheduled and reused among the 200 instances.

File Size:
Your wick file size was reduced 33 times.

2 Likes

i was thinking about doing something like this, but i didnt really know how