Starting Game Development [Game Maker, C# XNA A Personal Addition After]

edited in Tutorials
Programming
This (only has the Game Maker side) doesn't need complex understanding of how to program. Look up tutorials for learning programming if you are at that stage, especially since HOPEFULLY being here you know at least a little about programming.

{EDIT: this is a simple tutorial to create knowledge of starting out in Game Development, hence it is simple. Sorry.}

Create a GAME in Game Maker Studio
Game Maker Studio is easily available online, I used (and own GMS 1) but 2 has released - I haven't seen if it is different.

image

It is easiest looking on the left there is a list of items: sprites, sounds, etc. We will begin with sprites. Right click sprites and click "Create sprite" - call it "ship", click "edit sprite" and on the list of icons find and click "add an empty image at the end". It shows us an image (sort of) - just double click it. Fill it with the colour of your choice (mine was pink).

Now we do the same steps for an image we call "asteroid" - however click on transform (in the picture editing) and select "resize canvas", we can make it 3 x 3. Hopefully you used a different colour from your ship (I chose light blue).

The next step is "objects". These are things that do things in our game. We right click and create an object and call it "player". Under the window's options there is "sprite" - to the right of <no sprite> there is an icon - we click it and select the "ship" sprite we made.

To create events we will do something similar for both X and Y co-ordinates, we will just teach doing it once. Click "add event" and select "left" - now on the right hand side under "code" we add "execute code". We make our code in the popup, it is easy:
x = x - 1;
This should be understandable for you - we add the other 3 directions. No we do it for "right" (x increases), "up" (y decreases) and "down" (y increases).

This technically is almost usable. So let us do what we need to for actually using it.

Right click on "rooms" and click "create room". First swap to "backgrounds" on the left and click the colour tile and make it black. Swap to "objects" on the left and it should show the ship. Click a center position and it will place one.

Save the project and click "play" - the green arrow at the top.

There is nothing here really - but this IS A GAME. It is a boring one, we move a block on the screen = game. You should see this now slowly moves you around on the screen and you can go off sides. We will change that somewhat - we don't have to worry yet.

Now what we need to do is make the "asteroids". Create a new object and you will see we cant use "asteroid" because we used it before. To be simple name it "asteroidobject" for yourself. Set the sprite to asteroid.

In code we now add an event "step", add code to it. The code is simple "y = y + 1;". Create 3 in the room in random positions. Save and run (the constant save and run is to make sure you are getting things right).

Now on the player we add a new event. "Collision" with "asteroidobject" and add code. In the code we can do this simply:
show_message("You died!");
room_goto(0);
This tells us we died, and restarts the game. Test that for yourself running the game.
image

We need to do lots more (still) so to simplify it we won't do "fixes" yet. We will first make the game change itself.

Under the asteroid object's events add "other" "outside room". Add code:
y = 3;
x = 3 + random(room_width - 6);
instance_create(3 + random(room_width - 6), 3 - random(room_height - 6) , asteroidobject);
Running the game will show it works and slowly but surely becomes a huge grid. Yes it does inappropriately make more than one, but we will fix that soon.

We now make the player object's movements not go out the room (e.g. "if (x > 0) x = x - 1;"). We also make the asteroids move 3 blocks at a time and the player move 6.

We add a "create" event to the asteroid object and make "answer = false; alarm_set(0,30);" for ourselves. We check if answer is true when it moves from the room and if it is it makes it false.
if (answer == true)
{
y = 3;
x = 3 + random(room_width - 6);

instance_create(3 + random(room_width - 6), 3 - random(room_height - 6) , asteroidobject);

answer = false;
}
We add a new event "alarm" "alarm 0" and in the code we write:
answer = true;
alarm_set(0,30);
Play the game - technically it IS a game for us now, but let us add one extra change to make it simpler and nicer to understand.

To the player object we add a "Create" event and say "score = 0;". Then we make a "step" event and we say "score = score + 1;". Lastly we change the message it shows us:
show_message("You died! " + string(score));
image

Simple game - created. We are now "game makers" since that is a game, and it can be fun to play. Just relax and try beat scores of others.

The project will have a shared link at the bottom if you want it to double check, the others will also have some things shared (like code projects).

This is the end.

Additions can be requested or suggested, when I have time and capabilities - I enjoy helping others.

What you can do if you want to go to the next level and use a language, my blog post goes into C# and XNA for the exact same game. It works and can be the next step if you need it.

This was made as an attempt for me to check if I remembered how to MAKE GAMES. I document things for myself and since the changes in my life chose a personal blog. I shared the "Game Maker" side here, if requested (more than once) I will add the XNA side here too. I just kept it on "Game Maker" to keep this thread simple. This is also here since I might take my personal blog and throw it away.
Thanked by 2dammit texhkt

Comments

  • edited
    Just to add to this:

    You CAN add XNA to Visual Studio 2017 (which is new). Go through this MSDN blog post. However REPLACE the step 5:
    Version="14.0"
    With
    Version="15.0"
    However that install doesn't add compiling, I get the following error (any help is appreciated):
    Your installation of XNA Game Studio does not support this project (XNA Platform = 'Windows', XNA Framework Version = 'v4.0').
    XNA does compile in a Monogame project in Visual Studio 2017 (and is almost 100% completely XNA, content loading is different since it doesn't have a content project, look it up its easy) however not on its own.

    The compile working for me was latest Monogame, just with images to show on screen loaded and working (through it's XNA component) on the Windows 10 Universal Windows Project setup.
Sign In or Register to comment.