#code explanation
Explore tagged Tumblr posts
Text
I dislike using rigidbodies to move my objects because physics interactions can sometimes go ham and while that can be very amusing, I prefer things to be predictable. So for moving arrows in this game I handled the movement math myself via coroutine. Let's take a look-see, shall we? :3
The goal of this coroutine is to move its symbol object in an arcing motion from its initial position, moving it upward and to either the right or left. Then it will fall downward. Rather than having each symbol object run this coroutine from an attached script, I am using a central script (my GameManager) to apply this movement to a given object, so the first thing I do is make sure the symbol still exists before proceeding with the coroutine:
If we find that our symbol has been destroyed, we exit the coroutine with "yield break". You wouldn't need this check if the script is running this movement on its own object, as coroutines are ended upon an object's destruction.
There are a bunch of variables we'll define within our coroutine to calculate our desired motion; we'll start by defining an arcDuration:
This determines how long the object will take to move in the arc shape. A shorter duration results in faster movement. Using a random amount between a min and max duration creates some variance in how fast different symbol objects will move. I have my minArcDuration set to 1 and maxArcDuration set to 2.5 for quick bouncy movements.
These variables referencing the outermost bounds of the camera's view will be used to ensure that symbols remain within the visible area of the camera at all times. I'm not using a topBound because I'm fine with symbols possibly going off the top of the screen, but I use a maxArcHeight variable that is set low enough that they never do.
For even more spawn variability, we add a little randomness to our starting point. My spawnPointVariance is set very low at 0.3; my initial symbol spawn position is low on the screen, and due to how the rest of this coroutine works, it's important that the symbols are never allowed to spawn below the bottomBound or else they will be instantly deleted (and result in a miss!)
The height here is, of course, how far up the symbol will travel, and the distance refers to how far it will move to the left or right. We calculate the peak of the arc by adding our distance and height to the x and y values of our starting position. Randomizing between negative and positive distance values for our x position adds another layer of variability which includes the possibility of moving either left or right, even though our minArcDistance and maxArcDistance are both set to positive values for clarity (mine are set to 1 and 6).
This is the part of the code that decides upon our symbol's speed by calculating the distance it has to cover from its start to its peak. By dividing our horizontalDistance by our arcDuration (distance divided by time), we calculate how fast the symbol needs to move to cover the entire distance in the given duration. Mathf.Abs is used to ensure that horizontalDistance is always positive, lest we get a negative value that causes us to move in the opposite of the intended direction.
We'll also want a speed variable for when the arcing motion ends and the symbol starts falling, that's where downwardSpeed comes in. In earlier versions of this function, I used downwardSpeed alone to transform the object's position, but I've since refined the logic to take the current horizontalSpeed into account for more consistent motion; we'll see that later. (Also you can see I've been tweaking that arbitrary range a bit... the fall speed was brutal during those mass waves ;o;)
Here we create an elapsedTime variable starting at 0. In our while loop, we will use this variable to count how much time has passed, and if it becomes greater than or equal to arcDuration, we'll change isFalling to true and begin moving down.
We create a Vector3 moveDirection which gives the vector pointing from the startPosition to the peakPosition, and then turn it into Vector3 horizontalDirection, which retains only the X-axis direction. Both values are normalized to ensure consistency. Without normalization, the magnitude (or distance) of the vector would vary depending on the distance between the start and peak positions, which could result in inconsistent speed. Normalization caps the magnitude at 1, meaning the vector represents just the direction, not the distance, allowing for consistent speed calculation later.
Here's how we start our while loop: as long as our symbol object is not null and the game says we canMove, we say yield return null, which will instruct our loop to occur every frame. If either the symbol becomes null or canMove becomes false, the while loop will end and so will the coroutine - for this reason, I only set canMove false when the game ends and the symbols will never have to resume movement, rather than in cases where I want them to pause movement and resume later, such as when a player pauses the game or during level-up periods. For the latter I use an isLevelingUp bool in my while loop that waits until that bool is false before proceeding (yield return new WaitUntil(() => !isLevelingUp)), and for the former I actually change the game Time.timeScale to 0, which is not typically recommend but fuck it we doin it live, because I don't have a mechanism for resuming this function with appropriate variables if it is stopped. It could surely be done if you just store the local variables somehow.
This is the first part of our movement logic that we put in the while loop; remember we already set isFalling false, so this part will proceed with the rising motion.
We count our elapsedTime here by adding Time.deltaTime, a variable which represents the time in seconds that has passed since the last frame, ensuring that time calculation is frame-rate independent. Do NOT use Time.time in cases like this unless you want your users with varying computer specs to all have different experiences with your game for some insane, villainous reason
The variable 't' is looking at the elapsedTime divided by arcDuration, a ratio that tells us how far along we are in the arc movement. If elapsedTime equals arcDuration, this ratio would be 1, meaning the arc is complete. We use Mathf.Clamp01 to clamp this value between 0 and 1, ensuring that it won't ever go higher than 1, so that we can use it to calculate our desired arcPosition and be sure it never exceeds a certain point due to frame lag or some such. If 't' is allowed to exceed 1, the arcPos calculation could possibly go beyond the intended peakPos. We are going for predictable motion, so this is no good
We define our Vector3 arcPos with Vector3.Lerp, short for "Linear Interpolation", a function for calculating smooth transition between two points overtime. Ours takes our startPos and peakPos and moves our symbol between the two values according to the value of 't' which is incrementing every frame with Time.deltaTime. As 't' progresses from 0 to 1, Vector3.Lerp interpolates linearly between startPos and peakPos, so when 't' is 0, arcPos is exactly at startPos. When 't' is 1, arcPos reaches peakPos. For values of 't' between 0 and 1, arcPos is smoothly positioned between these two points. Very useful function, I be lerping for days
Then we alter the y coordinate of our arcPos by adding a calculation meant to create smooth, curved arc shape on the y axis, giving our object its rounded, bouncy trajectory. Without this calculation, you'll see your symbols rising and falling sharply without any of that rounded motion. This uses some functions I am not as familiar with and an explanation of the math involved is beyond my potato brain, but here's a chatgpt explanation of how it works:
Mathf.Sin(t * Mathf.PI): This calculates a sinusoidal wave based on the value of t. Mathf.PI represents half of a full circle in radians (180 degrees), creating a smooth curve. At t = 0, Mathf.Sin(0 * Mathf.PI) is 0, so there’s no vertical displacement. At t = 0.5, Mathf.Sin(0.5 * Mathf.PI) is 1, reaching the maximum vertical displacement (the peak height of the arc). At t = 1, Mathf.Sin(1 * Mathf.PI) returns to 0, completing the arc with no vertical displacement. This scales the vertical displacement to ensure the arc reaches the desired height. If height is 10, then at the peak, the symbol moves 10 units up.
With those positions calculated, we can calculate the "newX" variable which represents where we want our symbol to appear along the x axis. It adds the horizontal movement to the current x coordinate, adjusted for the time passed since the last frame.
We use Mathf.Clamp to ensure our newX value doesn't exceed either the left or right bounds of the screen. This function limits the given value to be between min and max value.
Finally we tell our loop to actually reposition the symbol object by creating a new Vector3 out of newX, arcPos.y, and using our symbol's own z coordinate. That last bit is important to ensure your sprite visibility/hierarchy doesn't go out of whack! If I used arcPos.z there instead, for example, it's likely my sprites would no longer be visible to my camera. The z position the symbol spawned at is the z position I want it to retain. Your needs may vary.
This part tells us our arcDuration should end, so we set isFalling to true, which will cause the secondary logic in our while loop to trigger:
Previously, objects retained their x position and only had negative downwardSpeed applied to their y position, but I didn't like that behaviour as it looked a little wonky (symbols would reach their arc peak and then suddenly stop and drop in a straight line downward).
By creating a new Vector3 fallDirection that retains the horizontalDirection and horizontalSpeed from the arc phase, we're able to apply smooth downward motion to the symbol that continues to the left or right.
Just below that, we once again clamp the symbol's x position to the left and right screen bounds so the symbols can't travel offscreen:
The loop would continue causing the symbols to fall forever if we didn't have this check:
which triggers some project specific logic and destroys the symbol, then exits the coroutine with "yield break". Although the coroutine already exits when the symbol becomes null, which it will see is the case in the next frame as we destroyed the symbol here, adding an explicit yield break is an added layer of security to ensure predictability. Once again, not super necessary if you decide to run this code from the moving object itself, but just be sure you move your Destroy() request to the bottom of any logic in that case, as nothing after that point would be able to trigger if you destroy the object which is running the coroutine!
and that's all folks. If this helps you make something, show me!
HEY, did you really make it all the way to the end of this post?! ilu :3 Do let me know if this kind of gratuitous code breakdown interests you and I will summon motivation to make more such posts. I personally like to see how the sausage is made so I hoped someone might find it neat. If ya got any questions I am happy to try and answer, the ol' inbox is always open.
#gamedev#solodev#made with unity#c sharp#tutorial#coding#programming#clonin game#code explanation#code explained
3 notes
·
View notes
Text



Let me live in my dreams of alonzo joining the party plsplsplspls
#metaphor refantazio#alonzo crotalus#fanart#my art#will metaphor#heismay noctule#i don’t know if the different patterns on their faces have actual explanations to them#so i took inspo from joker persona 5 ‘s mask lmao. he is so joker coded
508 notes
·
View notes
Text
the most common purpled and tommy hybrid hcs (alien for purp, devil/imp for tom) are the personifications of their insecurities but idk if people are ready for that conversation
#dream smp#cpurpled#ctommy#dsmp#c!purpled#c!tommy#technically not a goldenboys post because it’s not about their connection it’s about their lore#‘idk if people are ready for that conversation’ is just code for me asking you guys if you want that explanation#this was a 3am thought and it hit me like a train#saying alien purpled is a headcanon just because he left it up for interpretation even though i take it as canon
224 notes
·
View notes
Text
me when i found out that even 'instant' is a process:

#it's so smooth that you miss what awareness actually does in that microsecond#DON'T COME AT ME I HAVE AN EXPLANATION AND I SURVIVED ACCIDENTALLY EVAPORATING#shiftblr#reality shifting#shifting community#shifting blog#shifting#shifters#shifting antis dni#shifting realities#shifting perspectives#shifting reality#shifting advice#shifting awareness#shifting coded#shifting confessions#shifting content#shifting consciousness#shifting blogger#shifting memes
228 notes
·
View notes
Text
There’s something to be said about the general fandom inability to see platonic/familial relationships as complex, and electing to change them to romantic which is seen as a superior and more complex form of love.
#Victor’s void#aroacespec woes#‘there’s no platonic explanation for this’ is all well and good until the reasoning is because the characters have a complex bond#I’d also like to add that intimacy is NOT inherently queer coding
285 notes
·
View notes
Text
Alternative form of 'Hitting Wangxian with a Catboyification beam'
#poorly drawn mdzs#mdzs#wei wuxian#lan wangji#I don't have much more of an explanation to this other than 'i was struck by the vision and needed to create it'#They are both catboy coded. To me. On slightly different alignments of catboy but still.#LWJ is catboy: Fussy + bites and WWX is catboy: Stinky#Neither of them take well to being moved from their nap spot.#I love reading lying on my stomach and my cat just loves it. Hates being moved. We are locked in combat post any cuddle sessions.#I am a cat lover. I love them. They are Rotten little Stinkers. I love them#LWJ is like. *the* definition of 'cat that only likes those its in a bonded pair with.#The kind of cat that screams if it sees any neighborhood cats wandering outside.#wwx is a 'outdoor cat that wandered inside and became domesticated but NOT owned' kinda guy.#he is a menace on the local bird population and the only reason he's not dad to all the kittens is that he got fixed young.#UNLESS: the golden core transfer here was the balls (?) Animal control took JCs balls and WWX gave his up (????)#((I Also Don't Know What I'm Saying))
1K notes
·
View notes
Text
Transcript:
Who up wombing right now?
Audio source
#for those who Don’t Know#in the new update the main menu got an overhaul#part of it has code in the background and some of the code is in base64#when decoded it translates to ‘womb’#and people thought it meant V1 has a womb#but it’s just a header file#a header file is a way of adding already existing code into a different file without directly copying and pasting it#so it’s just using things from a file called womb#does that make sense#if you want a technical explanation just look up ‘what’s a header file’ and ‘what does [hashtag]include do’#BUT DONT LET THAT STOP YOU#freak activity is always encouraged here do crazy things to that machine#you can put any organs you want in there
84 notes
·
View notes
Text
“this show is making me like the men more” when the shows literally been setting this up from ep1. they literally eat people did you think they WERENT going to lose their morals more and more as the show progresses? did you think the hunting scene in season 2 was the worst it got and not the beginning of their descent into violence and horror? i feel like i’ve entered some alternate universe because half the complaints about season 3 make no sense to me and i just think a lot of you need to stop watching the show and just stick to reading fanfic or something because a lot of the complaints just sound like you dont like the season bc its not going the way you made up in your head
#saw someone say u cant ship lottieshauna bc theyre sister coded and that was the last straw#like what the FUCK are you talking about rn#what is this fandoms issue with immediately labeling stuff as familial#also the ppl complaining ep 5s title makes no sense as if the entire episode hasnt been setting up that other tai has been taking over the#adult timeline like 75% of the time#also COACH BEN WAS ALWAYS GOING TO DIE ALL THE CHARACTERS ARE GOING TO DIE EVENTUALLY THIS IS A HORROR SHOW#i thought everybody liked this show bc the characters were interesting and we all wanted to see how fucked up they got#like i’m still rooting for them to eat someone alive#dont even get me started on shaunamelissa just the worst takes ever with no explanation#i just think a lot of you read too much fanfic between the break and forgot what this show was actually about#zero curiosity with you mfs about what the seasons been setting up just immediately going straight to hating every episode and saying#it makes no sense. like ur just watching the show with ur eyes closed at this point#havent seen much here its mostly been on tiktok and twitter just insufferable#yellowjackets season 3#yellowjackets#sorry had to rant somewhere
67 notes
·
View notes
Text
as a sibling, people's takes on dick and jason's relationship ENRAGES me bc half of yall are only children or have had good or very shitty relationships with your siblings and it shows
#maybe ill write an in depth explanation on my thought process about them#i do want to#because some interpretations are so only child coded#and id really like to explain it flat#with someone whos had bad instances and good instances with their sibling#and as a younger sibling#dick grayson#jason todd#dc#dc robin#dc comics#nightwing#red hood
55 notes
·
View notes
Text
Honestly the best thing Book 7 can do is to keep Riddle in the dark regarding the scope of the dream situation.
Let him just think Malleus overblotted and went insane, I doubt he even has time to watch the video Idia prepared.
And then, when everything's settled and Malleus explains his reasoning, Riddle is just like "Ohh, so THAT'S what happened!! Malleus what the HELL?!"
#riddle is just so confused now lol#twst#riddle rosehearts#idia shroud#malleus draconia#idia really went: no time for explanations. Help me CODE.#twst spoilers
58 notes
·
View notes
Note
So where did Alpha's rather... intense reaction to being ordered around come from? A quirk in the programming? Was someone that was there when they were finally activated and/or reprogrammed, fixed up and brought to speed about everything that much of an arrogant d-bag it made a lasting impression?
First, the superiority of humans towards him and Beta, and on the other hand, the fact that humans are afraid of losing control, as happened with Biohazard, so they experiment with Alpha and Beta and keep them in a constant state of testing, doing whatever it takes to keep them in line and actually behaving and doing what they are told
Alpha hates power dynamics (ironically, he feels superior to humans in some ways), so he refuses to obey. He knows he's a robot and will never be like humans, so he follows his own rules. And he knows that he is MUCH stronger than humans. This makes him morally grey in the eyes of others, even though Alpha knows the concepts of right and wrong very well. Humans sometimes fear him even more than Biohazard because he seems kind, until he decides not to be anymore
He likes people to be polite, so he is more likely to do what you tell him if he perceives it as a favor and not a command
#Rustic explanation to avoid spoiling too much#but SO MANY people were asking this and it was starting to get hard to ignore#I'm sorry if this still doesn't explain anything at all but it's information I try to keep to myself#for now#GC Alpha#Gamma Code AU#Gamma Code fic#GC spoilers#asks
55 notes
·
View notes
Text
I FORGOT I HADN'T POSTED ANYTHING ABOUT THIS SPECIFIC WORLD YET BUT. I spent like 7 hours making a model of her silly ass so take a look at her.....
This is Ran! She and her girlfriend (who I'll post later) are new agents at the Anti-Extraterrestrial Defence Agency (AETDA), joining the fight against a mysterious alien corruption and the invading organisms.
The universe of CODE-51 is something I'm developing as a world open to others to make their own characters for! It's inspired a lot by magical girls, media from my childhood, superhero stuff, Transformers and Mega Man, and a whole host of other things. Again, I'll elaborate later lol.
#code-51#my art#ocs#ran code-51#blockbench#character design#I have a toyhouse world for it too#mind you that is still a work in progress#but ill link it in a dedicated explanation post later ^v^#1/20/2025 i updated this with her finished model lol
53 notes
·
View notes
Text
The Odd One Out
All roads leads to Home x Peach
Home's grandfather wanted a ceremony with a strict dress code of orange only.
And I thought it was just because the grandfather really liked the color orange.
Because in a show with a Pink Person, a Cyan Cutie, a Brown Beauty, a Red Rascal, and a Black Brooder (single father of four not pictured), I thought I had my fill of colors.
But as the maids carried out the grandfather's red and orange suits in episode eleven, it hit me.
This is a family of fiery personalities.
Phon is also a Red Rascal.
But she is everything negative about them.
She is vengeful.
She is murderous.
She is hot-tempered.
But Red Rascal Home doesn't have to worry about turning out like her because he has Brown Beauty Kan, Pink Person Pang, Cyan Cutie Home, and Black Brooder Suradech to keep him humble. And, of course, his uncle Somkid.
Who's been an oddity from the very beginning.
And I do mean the very beginning.
However, I trusted Somkid because Orange Oddities are normally optimistic and energetic, which he has been shown to be, but Somkid has his own mysterious and secretive Black Brooder.
Who helps Somkid be everywhere the color-coded kids are.
And I mean everywhere.
However, I didn't realize it because I was too busy focused on Home's wearing Peach's color all the time, which I have believed shows he loves Peach.
Which is why I was also excited when Home wore green (which is part of Peach's cyan) on his chest with his red accented shirt, yet ignored the orange on the stomach of Peach's shirt.
So when the cursed eleventh episode began I felt bad for Peach because he seemed to be struggling with his color as he believed Home didn't care if he left.
The same way Home struggled with his color when he thought his relationship with Peach was irredeemable.
Even though Pang maintained her color.
So when Peach magically gained his color back at the morgue, I knew something was off.
And, thankfully, the showed went back and told us that the Cyan Cutie and Red Rascal had actually worked everything out, so it would make sense that Peach would gain his color back before the morgue scene.
Because the thing about Peach is, unlike Home who has continuously worn Peach's blues and greens throughout the series, Peach isn't so quick to wear Home's red. He likes to save it for big moments, like when he signed "love"
So it was strange that the boy who has gone a journey with Home as they have both evolved (and fallen in love!) barely wears Home's red, while Somkid finally decided after decades of being the oddity of the family to wear red in solidarity with his family.
As if he was trying to prove he belonged in the family.
But the bad thing about Orange Oddities is, because they are attention-seeking and impatient, their actions can quickly become insincere if they feel slighted.
And their true color will easily emerge.
But as mentioned before, Peach likes to save his love red for Home for big moments, like when it's written over his heart with his color below as they prepare to take down Somkid. (Shoutout to the wardrobe department for grabbing a Rolling Loud Music Festival shirt!)
So we enter into the finale with
Black Brooder Suradech being rushed to the hospital,
Somkid showing his true color,
Home wearing his and Peach's combined colors in the same purple sweater he comforted Peach in when Peach faced his past,
Pang supporting her bother in blue with her pink on her chest,
Kan being the secure Brown Beauty,
and Peach in the same blue shirt he wore when Home made his dreams come true that proudly proclaims that "IT'S UP TO YOU" because he is the one who has the save the Red Rascal who quietly crept into his bed in the first episode and into his heart all season.
And now that "YOU" sits on his heart for everyone to see.
#peaceful property#on sale the series#the colors mean things#and they mean these two are in love!#I don't care what the show says#the wardrobe department has an agenda!#color coded boys in love#if I could have had fifty images in this post‚ this would be a lot easier to write#but noooooo!#I'm limited to thirty which stunts my explanations!#this was rough#but I had a point!#home x peach are in love!
69 notes
·
View notes
Text
Irl we have the Mambo number 5 by Lou Bega, but on Hermitcraft they have the Mumbo number 5 by Lou Beefa.
#hermitblr#hermitcraft headcannons#mumbo jumbo#vintage beef#this is so fucking stupid#for explanation- I came up with this joke after 4-5 hours of straight coding. it does something inexplainable to the brain
21 notes
·
View notes
Text
I hate-love silver age comics.
One one hand they can be fun and campy.
On the other they are soulless, nonsensical, and overly censored.
For those of you who don’t know- back in the time between the golden and silver age people started thinking that comics made kids into gangsters.
Literally the equivalent of saying that video games cause violence.
Right so- ✨the comics code authority✨ was created. If you had the stamp on your comic it was like a guarantee to the buyer that there was nothing that could remotely be a bad influence inside the comic.
bc of the public craze over comics ‘brainwashing’ the young- most of the big guns in comics just refused to publish comics without the stamp.
Funny enough- it died out after the government wanted marvel to publish a drug psa and the use of drugs was deemed inappropriate by the comics code authority.
…
Point is- fuck the comics code authority.
Also fuck you Collin.
#this is a really simplified explanation#i recommend researching yourself#it’s really interesting#batman#batfam#dc comics#dc robin#bruce wayne#silver age dc#silver age comics#marvel comics#comics code authority
33 notes
·
View notes
Text
my brain worms told me to do this
#reverse 1999#i doubt that anyone in the fandom is also interested in fashion dolls#but if they are#i would be interested in your thoughts very much 👀#everything started with me drawing marcus and she so blythe coded#i went with vibes aesthetics only#i was kinda convinced that Vertin had Pullip doll#i just have a clear image of her in doll form#bluepoch please collab with doll brands and get us Vertin as Pullip doll#also explanation for the vibes of each category:#50’s barbie - elegance and cuntiness#80’s barbie - colourful retro & that line of world doll line#bratz - self explanatory but bratzilaz is specifically for Willow#mh - self explanatory too#blythe - pretty and whimsy! with big eyes and thick fringe#ag - oliver fog is a bit funny considering that there is only one boy in ag history#but eagle and regulus are so ag coded!!#it - for me just tall and mature dolls that would look good in that expensive style#eah - fantasy!! cute! yay#pullip - realistically blupoch would collab with them probably#novi stars - i made that category with Voyager in mind#sorry i included only humanoid characters#also i got bored by the end
38 notes
·
View notes