ScratchData LogoScratchData
Back to TheColaber's profile

Platforiming Script... Shortest Ever?

THTheColaber•Created July 31, 2020
Platforiming Script... Shortest Ever?
12
10
168 views
View on Scratch

Instructions

Soooo... Yeah... This competition was uh... every interesting... I though I'd give it a try so uh... Read til the end before you see inside... trust me... Oh yeah... I don't count as a competitor btw... I wish though... My Stats: Lines of Code: 18 Bugs: 0 Missing Elements:1- I just couldn't figure out that lava:( Variables: 1 - The Level Variable That's a total score of 20! In usual platform physics... normally, the player can go through the slimmest things just because it falls or moves very fast... however... instead of changing it's y position by a high y velocity, I step through every frame of the velocity so I can sense the platform for every pixel it goes down... that may be a little complicated, I know, but just know that that bug is impossible to get! Here's a project that better explains it: https://scratch.mit.edu/projects/23602667/ If you see inside to look at the code... I promise you will be shocked... There is so much recursion happening and it get's very complicated... I still have trouble trying to read my code again... but uh... here's a really nice explanation: https://scratch.mit.edu/discuss/youtube/Mv9NEXX1VHc/ Above, I wrote that I only create one variable... 'Level'... You must be wondering then how I implemented the x and y velocity... Well, scratch was very kind to already have 3 locally created variables witch are: direction pitch - found in the Music Extension volume Now of course there are many more, like size and x position... but we can't use any variables that effect the placement and size of the player... Anyway, I though it would be easy to use all 3 I stated above instead of my created variables, but there were a few limitations... Here they are: direction- only go from -180 to 180 (which is fine) pitch- only go from 20 to 500 (so no negative numbers) volume- only go from 0 - 100 (so no negative numbers) With volume there was another limitation... if ran without screen refresh in recursion, it will slow down everything sadly... So I was left with just direction and pitch... Direction I used as the y velocity witch is why, on the screen, the color of the variable is blue... However, since pitch was limited to no negative numbers, I needed to find a way to make it possible... So, I kinda, used some operator blocks and shifted a pitch of 200 to be moved to 0... you will see if you show the variable... And that's kinda how I did it... I'll give credit to @FUNUT for some ideas on how I shrunk my platforming script as much as I could... I'll also give credit to @GarboMuffin for showing many styles of platforiming scripts... That's pretty much it... this section is more like a documentation... If you have any questions, ask me, but whatever you do, do NOT ask me how everything works... Thanks - @TheColaber (lol, shared at 1:50 A.M.... Yawn, I'm tired... I've spent a month on this... Good night... Results will be shared soon!) (Why do I always use '...' a lot... Eh... I'll never know) (If you have read this far, great job... it is now 1:53... Why am I still typing lol... Why are you still reading? lol... ok... see you in the morning...)

Project Details

Project ID414983548
CreatedJuly 31, 2020
Last ModifiedJanuary 4, 2021
SharedJuly 31, 2020
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root