Secret of Mana stlye inventory wheel [Game Maker | Basics]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there this is oneup in the year with another Basics video tutorial about what what you're seeing around in front of you The Wheel of Fortune or basically just a rotation uh wheel for spells or inventory or got know what you've seen that in let's say Secret of Mana and I wanted to recreate that as quickly as possible so if you want to join me on the small little journey then stick around this is oneup Indie I am a developer so if you like what you're seeing and hearing then why not consider sharing and liking to my small little potato channel here on YouTube all righty so let's uh start off with something a little bit more visual let's go into yeah so um first of all we need a few things which we want to pass in before we want to uh well do the whole spinning stuff so first of all we need two things so first of all kind of an array which we are filling up with um images so um I don't know how many images we're having let's say one two three and therefore um we need to also need to know let's say how big one slice of this piece of this wheel of this thing of this P whatever you want to call that is so this is how this variable here one piece and this is uh which we're going to pass in and all the other stuff this you can forget the length so this is from starting point here H let's give it another one starting point here to here this is the length then the de is basically the angle which we're having here for rotation oh beautiful this is of course very unfortunate get away um so this the is um well a rotation value an angle which all of the guys are well has to stick to it's kind of important and then uh rotation speed is kind of self-explanatory and then later on we have kind of a state which is starting this idle and let's say you press left or right then we rotate from one position to the other one that's pretty much it and if you just wondering wait a minute so why is De starting as 90 well good question because let's say if you do like this this is the zero position looks kind of bad we want to have it at the king position at the top so this is what we want to have so let's go into game maker and get rid of all that stuff here and then first of all we have for example our player we just press the button doesn't really matter what what you do here and then for example we're creating our wheel and then we pass in images so first image second and so on and then we want to know how big one piece is and one piece is let's say one part of 360 so for example if you just have one well it's 360 so therefore we just um take the array length so of this guy here because we have it with four values here or let's say with three doesn't really matter it's all the same will work out just fine those three values and divide it then here by three so this is what that means we just take array of the filled up stuff here so therefore we just go and uh have filled it up once we spawn it with let's say three values and now we need to draw a few things so first of all just for understanding let's for example have a kind of a this to selection and then we just draw it at the top point so for that we just have XX and y y these are just the y y y yeah three y y right and just say like hey with the length steer and then 90 which is our top position then for example once we started we will see our selection tool and this is yay working awesome and therefore we can actually use this logic and also while draw all the other things so here we do a similar thing like this just go and take one X and Y off and um we want to take one of those from the array which we created here and then I don't know set it to I cuz I will do a sneaky little trick here not too sneaky to be honest but uh oh well let's make programming a little bit more interesting than uh uh it should be um yeah so for example once we for example do something like this we should be drawing on top oh crash no not crashing excellent our first Sprite so the Bell here excellent but of course we want to have all of them so we just say like repeat uh here we go and then of course uh i++ basically we're just iterating through all the positions here so how many of them we want to have well kind of easy we just say like hey array length of our well array which is filled up with now three or two doesn't really doesn't well depends how many positions you passed in and then um this is still not working because we need to get the correct um calculated uh D so the angle Al the angle so how can we calculate it well we just call it dial and say like okay our Global rotation value D times e and then one piece so here for example we divide it by three so each piece is 120 so e is getting iterated so each time it's getting big bigger and then therefore for example once we start this thing here let's see if it's crashing no it's not good we drawing um with one piece next piece and the other one and then on the top excellent so this is working pretty fine so the next thing which we want to do is kind of have our mini State machine and then for example once for example we pressing left we just set our state to rotate left or we're pressing right so here just this is how that looks like pressing left or right get rid of you it's not that important so let's say for example we just say like hey we are we toggle the state rotate left so what do we do first of all we want to um well let our deer roll so we just want to increase this angle so plus equals no not for left and then how fast well with our rotate speed and for now this would now turn for all eternity not the best thing so that therefore we just have another variable I just call it rotate amount doesn't really matter it's kind of a timer or a value which is getting updated and then once it hits a threshold what kind of threshold well and hopefully you can also guess it well what kind of value could it be well the ones which we defined here are one piece so here if our rotate amount is bigger or equal then for example one piece then we can just say like sweet let it set up back to idle there we go and then of course reset this value also to zero so therefore we just have a rotation between one slot point or one piece or one Sprite or one position to the other one then of course we can do the same stuff for rotate right and then we just update it here just take a plus and then we are pretty much done we are we did all this thing in a hopefully not too Speedy way oh it's working it's not crashing it's good I was expecting it to crash it did not so that was pretty much it so hopefully in under 10 minutes yes hopefully that was not too fast for you guys uh code in description box yeah I guess the code in the description box hopefully um that was of entertainment and you got your money worth here have a good one one up indie
Info
Channel: 1up Indie
Views: 583
Rating: undefined out of 5
Keywords: game maker tutorial, game maker studio tutorial, gamemaker studio 2 tutorial, game dev, game developer, gamemaker rotation inventory, gamemaker object rotation, gamemaker set rotation, gamemaker secret of mana, gamemaker rotate object, gamemaker how to rotate object, how to make object rotate in gamemaker
Id: Kv6eVL5vA4M
Channel Id: undefined
Length: 9min 10sec (550 seconds)
Published: Tue Apr 16 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.