Arrays in GameMaker Studio - Part 1

  Рет қаралды 10,253

Let's Learn This Together

Let's Learn This Together

Күн бұрын

Пікірлер: 41
@ross9195
@ross9195 4 жыл бұрын
This was the best tutorial for arrays in gamemaker i have found. Thank you for uploading this.
@sirGuy1995
@sirGuy1995 Жыл бұрын
Thank you! As someone without a ton of professional coding knowledge, this was an excellent introduction to the concepts!
@zarteen
@zarteen 6 жыл бұрын
Thank you for this. This was exactly what I needed to really start improving c:
@a.vanmeel1208
@a.vanmeel1208 3 жыл бұрын
Great Job. Thank you for this tutorial.
@danieladamczyk4024
@danieladamczyk4024 6 жыл бұрын
Understunding of arrays is thing what i need to make my game. Keep going whit it. Good stuff.
@LetsLearnThisTogether
@LetsLearnThisTogether 6 жыл бұрын
+Daniel Adamczyk Part two is coming out soon.
@danieladamczyk4024
@danieladamczyk4024 6 жыл бұрын
Beyond Us Games thank you
@winniZX81
@winniZX81 6 жыл бұрын
Excellent video. Keep up the good work
@Quentin94
@Quentin94 3 жыл бұрын
Thank you, this will help a lot.
@Cablesfish
@Cablesfish 3 жыл бұрын
Awesome video. Thanks a lot!
@spiritgame6259
@spiritgame6259 5 жыл бұрын
Excellent video!!!!
@SonictheHedgehogInRealLife
@SonictheHedgehogInRealLife 4 жыл бұрын
Your intro is really cool
@astrobread7300
@astrobread7300 4 жыл бұрын
thank you man this helps
@Clod15
@Clod15 5 жыл бұрын
Thank you very much! =]
@NaikoArt
@NaikoArt 5 жыл бұрын
awesome!
@ryarod
@ryarod 3 жыл бұрын
Hello. Regarding the making of the "menu" array: Is creating an array as simple as just typing one word with a "[#] =" attached? Or is there something else we have to do in order to make that an array in the first place? I ask because I see you typing "menu[0] = "New Game""; "menu[1] = Load Game"; etc., and you achieve results for your tutorial; and yet, I try something similar in my project and I've yet to achieve critical mass, as if it doesn't read that the array is there. That being said, I'm doing something different from making a menu, so it could be I just have the wrong context; hence why I'm asking.
@LetsLearnThisTogether
@LetsLearnThisTogether 3 жыл бұрын
Yes, creating an array is as simple as that. GML makes it very easy. What are you trying to do?
@ryarod
@ryarod 3 жыл бұрын
@@LetsLearnThisTogether I am making a point-and-click adventure game. I have given my cursor icon separate sprites for separate states, depending on what the cursor is hovering on. I want the cursor to change its shape if it lands on any of several particular objects of interest. I have successfully made it change shape like this for when it's on top of one particular object. I wanted to create an array that contains all objects of interest, and then just put that array's name where that one object is. This has yet to work.
@LetsLearnThisTogether
@LetsLearnThisTogether 3 жыл бұрын
Hmmm. I might do an array like you’re saying, and then just have each object have a number and that number corresponds to what slot in the array the mouse should look like.
@ryarod
@ryarod 3 жыл бұрын
@@LetsLearnThisTogether I'm about to try it. I must say though that seems in text to be nearly the same: I still have to code an entire block per individual object, it's just I'd be using a number instead of the object name. If I could type a range, I could use just one block to react to all those objects. Hence my being here on Arrays.
@LetsLearnThisTogether
@LetsLearnThisTogether 3 жыл бұрын
Hmm, maybe we’re not communicating clearly. I think I understand what you’re trying to do, and the solution I suggested would have you create just one array and then one variable in each object. You don’t need a lot of code. The mouse object has an array of all the different sprites it can be. The other objects just contain a number, an index in that array, that the mouse changes to when it’s colliding with them.
@whoolieman
@whoolieman 6 жыл бұрын
nice tut !
@elbituan
@elbituan 4 жыл бұрын
My friend, for some reason the machine translation subtitles are failing, can you please verify your video in video editing CC options and validate the overlap?
@Orangetictac
@Orangetictac 4 жыл бұрын
Did you figure out how to not have it go a mile a minute at the 12:47 mark without slowing the room down? This is what I am stuck on, trying to get text to stay there for a while but picking randomly after that while is down. Thanks!
@marzipug5439
@marzipug5439 4 жыл бұрын
I assume you could put the code to randomly draw the text in an alarm with a timer on it. Just set the alarm to room_speed*(seconds) and then make sure to reset the alarm to make it loop (put alarm[0] = room_speed*(seconds) at the end of the alarm[0] event.)
@Troylglover
@Troylglover 4 жыл бұрын
how do I write this, outside of a 'text' ? I can't figure out how to write the random 'menu' menu[0] = "0"; //E menu[1] = "45"; //NE menu[2] = "90"; //N menu[3] = "135"; //NW menu[4] = "180"; //W menu[5] = "225"; //SW menu[6] = "270"; //S menu[7] = "315"; //SE menu[irandom(array_length_1d(menu)-1)]; if(menu = 0){ sprite_index = sguardwalke; } else if(menu = 1){ sprite_index = sguardwalkne; }
@LetsLearnThisTogether
@LetsLearnThisTogether 4 жыл бұрын
The problem I see is you're wrapping your integers (numbers) in quotes, which makes them a string. You can store anything in an array. Remove the quotes. Then when you compare, be sure to use == instead of just = (I know GM won't throw a fit most of the time, but it's better to learn good coding habits now). After that, it should work, because you'll no longer be comparing a string to a number, but a number to a number.
@Troylglover
@Troylglover 4 жыл бұрын
@@LetsLearnThisTogether Thank you for helping me. I made the changes. It only chooses either 0 or 180 but the sprite_ index wont change. I'm very new to GMS, I don't see what I'm wrong lol
@mchsprod
@mchsprod 3 жыл бұрын
I was a bit “eh” about arrays until you talked about the for loop not caring about the amount of items. At that moment I had flashbacks to programming with Scratch, having to make a new variable for every item, having to copy code and dealing with so many problems. I knew arrays were helpful, but you made me realise that a world without arrays would be a nightmare.
@LetsLearnThisTogether
@LetsLearnThisTogether 3 жыл бұрын
Glad to hear I was able to induce flashbacks to traumatic events :)
@naelpontes8444
@naelpontes8444 Жыл бұрын
You can also make an empty array by just typing smth like array_name = [ ] , iirc
@lauren9290
@lauren9290 4 жыл бұрын
that do be useful
@realpunkfruit
@realpunkfruit 4 жыл бұрын
i think i have arrays down, for loops are still giving me a headache tho ;P
@LetsLearnThisTogether
@LetsLearnThisTogether 4 жыл бұрын
Yep, sounds about right. They take a lot of practice, so just don’t give up.
@sev7nsev7n7
@sev7nsev7n7 5 жыл бұрын
how can I use an array as a variable, and if any of the elements in there is true then do whatever?
@LetsLearnThisTogether
@LetsLearnThisTogether 5 жыл бұрын
Just like anything else in GMS. myArray[0] = true; myArray[1] = false; Your variable is myArray and then you've got index's you access with the brackets []. If you put a value in there, then you can access it, but if you don't and try to access it you'll get an error.
@Troylglover
@Troylglover 4 жыл бұрын
I have this in the create event menu[0] = 0; menu[1] = 45; menu[2] = 90; menu[3] = 135; menu[4] = 180; menu[5] = 225; menu[6] = 270; menu[7] = 315; image_speed = 1; -------------------------------------------------------------- I have this in the spacebar event menu[irandom(array_length_1d(menu)-1)]; if(menu == 0) {sprite_index = sguardwalke;} else if(menu == 1) {sprite_index = sguardwalkne;} else if(menu == 2) {sprite_index = sguardwalkn;} else if(menu == 3) {sprite_index = sguardwalknw;} else if(menu == 4) {sprite_index = sguardwalkw;} else if(menu == 5) {sprite_index = sguardwalksw;} else if(menu == 6) {sprite_index = sguardwalks;} else if(menu == 7) {sprite_index = sguardwalkse;} this is the error message I get Error : gml_Object_oguard_KeyPress_32(0) : malformed assignment statement
@LetsLearnThisTogether
@LetsLearnThisTogether 4 жыл бұрын
Upload your project somewhere and send me the link, I'll take a look at it. You can also email me at aaron@letslearnthistogether.com
@Troylglover
@Troylglover 4 жыл бұрын
@@LetsLearnThisTogether do you have dropbox?
@LetsLearnThisTogether
@LetsLearnThisTogether 4 жыл бұрын
Sure do.
Arrays in GameMaker Studio - Part 2 (2D Arrays)
17:53
Let's Learn This Together
Рет қаралды 9 М.
GameMaker - Better Saving & Loading (JSON)
25:49
Sara Spalding
Рет қаралды 46 М.
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 121 МЛН
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 3 МЛН
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 59 МЛН
Lists and Grids in GameMaker Studio 1 & 2 - Data Structures Series
9:55
Let's Learn This Together
Рет қаралды 6 М.
The Basics of Paths in GameMaker Studio 2 - Tutorial
15:28
Let's Learn This Together
Рет қаралды 32 М.
The 15 Commandments of Game Maker
16:32
PixelatedPope
Рет қаралды 124 М.
Grid Aligned Movement - GMWolf
8:33
GM Wolf
Рет қаралды 30 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 720 М.
Data structure - ds grid [Game Maker | Basics]
12:52
1up Indie
Рет қаралды 4,7 М.
Concepts & Setup | Cutscenes [1]
19:48
FriendlyCosmonaut
Рет қаралды 49 М.
Why Does Celeste Feel So Good to Play?
17:34
Game Maker's Toolkit
Рет қаралды 2,7 МЛН
How to Make a Menu System (with Submenus) in GameMaker Studio 2!
32:39
Peyton Burnham
Рет қаралды 160 М.
5 Useful Scripts for GameMaker Studio 2 (and 1!)
9:34
Sara Spalding
Рет қаралды 100 М.
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 121 МЛН