JR 01's Weekly Coding Challenge

I’m starting a weekly coding challenge, anyone can participate. If you are struggling with the challenge, don’t be afraid to ask and I can give hints. There is also next week, so if you don’t understand the solutions, then try a lower difficulty next week. Also please use the hide details function when posting your answer, this way it gives more users a chance to solve the solution and it just makes it much more easier to see everyones answers one at a time.

Monday - Beginner
Wednesday - Intermediate
Friday - Challenging
Random - Expert

Additional Rules:

  • Do not use my code or my examples, I will know and will make adjustments to the challenge.
  • If you already have the code for the challenge, I request to make it from scratch.
  • The answer can be a game link or a screenshot (Win+Shift+S).
  • When posting an answer, please use the Hide Details function (in the gear icon).
      • [details="Answer"] Paste you answer here [/details]

Expert Challenges

Expert challenges will be posted randomly thoughout each month, so keep an eye out.
Those who finish the expert challenges first will have their names list below:

@Flying_fajita - Spawn a wave of spikes


Screen Loop

April 1st, 2024 (this is not april fools)
Difficulty: Beginner

Screenshot the code of looping (teleport) an object across the screen like in the arcade game ‘Asteroids’. Meaning the object needs to warp from one side of the screen to the other when passing the edge. For this scenario let’s use a 12x12 screeb size (384x384 pixels), and must work on any edge of the screen.



{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":0,"name":"Asteroids","behaviorType":"logic.NodeGroup","x":-90,"y":288,"group":"ab37d6c673f99442","id":"989f75a183e1554f","isMenuItem":false},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-540,"y":-16,"group":"989f75a183e1554f","id":"98a02dd3ba25e641"},{"inputCount":0,"outputCount":1,"name":"Once","behaviorType":"logic.triggers.Once","x":-540,"y":-128,"group":"989f75a183e1554f","id":"98a04f35e0758a4a","resetOnLevelStart":false},{"inputCount":5,"outputCount":5,"name":"Full Screen","behaviorType":"logic.components.FullScreen","x":-360,"y":-128,"group":"989f75a183e1554f","id":"98a0612093e6104d","smIdx":0},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":-360,"y":112,"group":"989f75a183e1554f","id":"98a0eadca370fe4e","targetId":0,"prop":"y","version":2},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":-360,"y":-16,"group":"989f75a183e1554f","id":"98a0eb77c2541e43","targetId":0,"prop":"x","version":2},{"expression":"B < -C? A+C/2 :B > (A+C)? -C/2 : B","default0":0,"default1":0,"default2":32,"default3":0,"default4":0,"default5":0,"params":3,"version":2,"tag":"","inputCount":4,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":-180,"y":-16,"group":"989f75a183e1554f","id":"98a1c7adf5b7c149","notes":"B < -C? A+C/2 :\nB > (A+C)? -C/2 : B\n.\n\nC = bounds.\nSet to 32 pixels before wrapping.","n_o":1},{"inputCount":4,"outputCount":2,"name":"Position","behaviorType":"logic.properties.Position","x":0,"y":-16,"group":"989f75a183e1554f","id":"98a411ec38192745","pixelUnits":true,"resetVelocity":false},{"expression":"B < -C? A+C/2 : B > (A+C)? -C/2 : B","default0":0,"default1":0,"default2":32,"default3":0,"default4":0,"default5":0,"params":3,"version":2,"tag":"","inputCount":4,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":-180,"y":112,"group":"989f75a183e1554f","id":"98a4cbfb2c314a41"}],"links":[{"input_id":"98a0eb77c2541e43i0","output_id":"98a02dd3ba25e641o0"},{"input_id":"98a0eadca370fe4ei0","output_id":"98a02dd3ba25e641o0"},{"input_id":"98a0612093e6104di3","output_id":"98a04f35e0758a4ao0"},{"input_id":"98a0612093e6104di4","output_id":"98a04f35e0758a4ao0"},{"input_id":"98a1c7adf5b7c149i0","output_id":"98a0612093e6104do3"},{"input_id":"98a4cbfb2c314a41i0","output_id":"98a0612093e6104do4"},{"input_id":"98a4cbfb2c314a41i1","output_id":"98a0eadca370fe4eo0"},{"input_id":"98a4cbfb2c314a41i3","output_id":"98a0eadca370fe4eo0"},{"input_id":"98a1c7adf5b7c149i1","output_id":"98a0eb77c2541e43o0"},{"input_id":"98a1c7adf5b7c149i3","output_id":"98a0eb77c2541e43o0"},{"input_id":"98a411ec38192745i0","output_id":"98a1c7adf5b7c149o0"},{"input_id":"98a411ec38192745i1","output_id":"98a4cbfb2c314a41o0"}]}}}
1 Like

That’s a good technical answer, though its very simple to do without expressions.
If anyone newer to flowlab wants to try this using numbers and filters instead, please give it a try.

1 Like

What would an expert challenge even look like? Would it be a feature that would require a ton of code and knowledge, or some sort of mechanic that could be done with small amounts of code (so it can be easily viewed), but still be complicated enough for not many users to know how to make it.

1 Like
I'll just wait until I can actually do something...
1 Like

It’ll be a specific case where you need pretty good knowledge on how to make it. It may not be simple but will probably still fit on a screen. It could be a mechanic, haxe code, or using a behavior in a unintended purpose.


Is that like editing behaviors using custom text and then importing it? I’ve only ever dealt with the flowlab behaviors and never had a use to custom make behaviors.
At least I’ve seen some users try it before, but I never knew how to do it.

Nope, haxe is the programming language you can use inside the expression behavior. You can make complex mathmatics, like how I made the ease bundle.


Oh, alright. Then I already know some of it.

I’ve had to use Absolute value, and some Sin, Cos, Tan, on it before, but there’s definitely some equations I don’t know on it.

1 Like

here’s my idea for an expert challenge:
jr_01 gives us a few codes and what one of them means, we have to automate a system within code to decipher whatever code language he uses to hide text

expert challenges shouldn’t just require knowing alot about flowlab, but also a lot of logical thinking and problem solving.


Heres the expected beginner answer for this challenge, with filters.


When i first try to make asteroids in 2016, I used a collision with walls outside the game. There are multiple answers to these challenges, I just want users to try and share their answers. Its a good way learn new things in flowlab.


Moving Platforms

April 3rd, 2024
Difficulty: intermediate

Share a pair screenshots, one for the physics property of the object that is needed to make a moving platform that the player can stand on. And the other of the code to make a platform move between 2 objects. The platform needs to be able to move between 2 objects no matter how far apart the objects are.

Moving platforms in Unity! - Daniel Ercilio Del Rosario Guerra - Medium


Physics settings:


Wait, wait. This is intermediate, and the last one was beginner? Huh. I think I’ll try this one.

My answer (F)

Platform physics:

Platform code:

Player code (Other than Run & Jump):

I know that this isn’t the correct answer. I think it works the way you said though. I probably didn’t do that well.
EDIT: Oh no, it doesn’t work. On the second switchback, it doesn’t stop! I’m really sorry, but I’m very confused.

Any answer that has it working is correct, the platform is suppose to keep going, unless you mean its not going back and forth. Instead of using position, try using velocity instead to move the platform. Position is basically constantly teleporting the platform, so its not pushing the player standing on top with it. If you are still having issues, you can link the game and I can take a look at it.

1 Like

On the second switchback, the platform goes through the ground object, since I’m using position. If I used velocity, then I’d have to make it moveable. When I tried that, the platform fell as if it had gravity (But I turned it off).

I’ll see if I can find a way to keep it suspended based on the player’s density, that’s the only way I can think of.

No, you do not need to make the platform movable to use velocity.
You do have to set to movable to use motor and impulse unfortunately (hope grazer changes that).
Using velocity to a nonmovable object turns it into what is called a “kinematic” object, meaning it is an unstoppable force which makes it perfect for platforms and elevators.

1 Like

Interesting. I am learning new things with this. Thanks a bunch JR01! I will try again.