Super LASER BLAST!
-
Looks awesome!
-
@vinicity Looks great! I love the use of my template!
-
Someone asked me about the algorithm for determining if the the laser beam touches the circles. So, I thought I would write a little bit about it.
At first, I thought the problem of determining where a line crosses a circle wouldn't be very hard, but it turns out that it is far from trivial. I googled a bit and found that the maths behind it are rather tricky, and there are a lot of different ways to solve the problem. In one of the threads on StackOverflow, someone mentioned that they had solved it with a recursive function, so I thought I would try that as well.
What is a recursive function?
In computer science, recursion is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem. Recursion solves such recursive problems by using functions that call themselves from within their own code.
For this to work, the function must have a "base case" which terminates the recursion, and it also needs to divide or shrink the input data, which then becomes the in-data for the next recursion call.
My solution
Since we have the angle for the laser beam, and the location and radius of the circle, first off we can just use some simple trigonometry to determine if a circle will be hit or not. If it will be hit, we call the recursive function called
intersectsBlob()
. It takes as input parameters the circle (circles are called blobs in my code), and the start and end points of the line (or laser beam) we want to check.The function
midPoint()
return the midlle point of the line:Then we have the "base case" which terminates the recursion. If the distance from the middle point of the line to the blob's center point is the same as the radius, then we have found the answer:
Note that it actually terminates if the difference is less than 2 pixels. This is good enough, and keeps us from hitting Fuze's recursion limit.
Next, we divide our line into two equally long lines, and check which of them has a middle point that is closer to the answer than the other. The one further away is discarded, and then we call
intersectsBlob()
(that is, the same function that we are in) again, but this time with the new line coordinates:And then we just return the answer.
That's it. The entire function looks like this:
-
-
You finally used your particle system in a way that I truly enjoy. When that laser hits something. It looks so cool.
-
So very satisfying to watch! Congratulations - awesome work.
-
-
@Dave , may I please request that you add some thumping techno with the next patch?
Pretty, please?
-
@vinicity Won't be able to for the next patch, but certainly for subsequent ones I could look at it :)
-
The game is now finished and has been shared.
Download ID: HBG33MND5CThe game is now called Super LASER BLAST!
It is a relaxing puzzle game, with mechanics inspired by an old flash game called Gimme Friction Baby. Try to rack up as many points as possible by making combos!
It supports both touchscreen and joycon controls, and you can switch display modes on the fly in order to play it with the Switch on the side (Tate style!) or the other way up (for instance when playing on the TV).
Big thank you to @Retrocade_media for the Tate Template code and to @spikey for the persistent High Score code!
I hope you like it, and please post your high scores in this thread!Expect a new update shortly with support for a new Time Attack game mode.
-
@vinicity glad to hear this code was useful! I will right away try Super LASER BLAST.
-
@spikey Yeah, a great piece of code, very neat and easy to use! Thank you for that!
-
I like this you've done a great job. Cool graphics and an original mechanic for the gameplay. And the touch controls make it just a great way to play.
-
It'll be a minute before I get back to my switch, but I'm excited to try this out!
-
@vinicity ID: DM3N3MNDN8 (DEMO - High Scores V2.0, for saving multiple tables)
cheers 😀
I added also aresetHighScores()
function. -
I don't know why but can't download it because the ip (HBG33MND5C) it says project: not found is this showing to everyone or is just me?
-
This means that it is awaiting approval. It takes two people to approve a program and unfortunately it is just me here at the moment
-
Hold off, I found a game breaking bug. Will fix and re-share.
-
New update is now live!
Please download the latest version of Super LASER BLAST, since there are lots of bug fixes and new features.
Changes made in Version 2.01 (Release date 2020-09-02):
- Added immersive HD Rumble
- Added Rank view in HUD + Rank up sound effect
- Added Time Attack mode
- Added Expert Mode
- Added new loading screen (thanks, toxibunny!)
- Added support for multiple high score tables (thanks, Spikey!)
- Various fixes and tweaks
Time Attack turns the heat up by making every second count as you race to beat the highest scores. You only play for six minutes, making this the perfect mode to play while waiting for the bus or for your next zoom meeting to start.
Expert Mode is not for the faint of heart! Only true experts have a chance when circles that are left alone increase their health after every fourth shot fired. Once health reaches ten, the circle becomes indestructible. Better not let that happen!
-
Version 2.02 is now live.
Contains fixes to make Super LASER BLAST work in Fuze 2.15.