The VG Resource
Game Maker and GML thread - Printable Version

+- The VG Resource (https://www.vg-resource.com)
+-- Forum: Archive (https://www.vg-resource.com/forum-65.html)
+--- Forum: July 2014 Archive (https://www.vg-resource.com/forum-139.html)
+---- Forum: Other Stuff (https://www.vg-resource.com/forum-6.html)
+----- Forum: Questions, Info, and Tutorials (https://www.vg-resource.com/forum-89.html)
+----- Thread: Game Maker and GML thread (/thread-21689.html)



Game Maker and GML thread - ZeldaClassicEXPERT - 10-15-2012

Please do not worry though, this thread and post is extremely easy to understand.

Uploads are okay if all of the four conditions are met:
#1: legal

#2: safe

#3: allowed

#4: permissioned


GML stands for Game Maker Language

III stands for 3

NES stands for Nintendo Entertainment System

Talk about Game Maker, GML etc. here


Example:

Code:
Just like in Mega Man III for NES
Mega Man III Stage Selector object’s sprite status:
Origin X: 0
Origin Y: 0
Have Precise collision checking used
Does not have Smooth edges
Does have Preload texture
Bounding Box Left: 0
Bounding Box Top: 0
Bounding Box Right: 51
Bounding Box Bottom: 47
Sprite Height: 48
Sprite Width: 52
Top left pixel of its sprite is on x: 3 y: 0 with only 3 (x: 0 y: 0 x: 1 y: 0 x: 2: y: 0) nothingness to the left
Of its top left pixel




Code:
Just like in Mega Man III for NES
Mega Man III Stage Selector left pressed object's status:


sound_play(stageSelectorSound); //Plays the stage select Sound just like in Mega Man III for NES

//Top Row
if place_meeting(x,y,sparkManCubeObj) //just like in Mega Man III for NES if colliding with Spark Man Cube's object
{x = needleManCubeObj.x; exit} //just like in Mega Man III for NES now go to Needle Man Cube's x and then exit
if place_meeting(x,y,needleManCubeObj) //just like in Mega Man III for NES if colliding with Needle Man Cube's object
{x = snakeManCubeObj.x; exit} //just like in Mega Man III for NES now go to Snake Man Cube's x and then exit
if place_meeting(x,y,snakeManCubeObj) //just like in Mega Man III for NES if colliding with Snake Man Cube's object
{x = sparkManCubeObj.x; exit} //just like in Mega Man III for NES now go to Spark Man Cube's x and then exit

//Middle Row
if place_meeting(x,y,megaManCubeObj) //just like in Mega Man III for NES if colliding with Mega Man Cube's object
{x = hardManCubeObj.x; exit} //just like in Mega Man III for NES now go to Hard Man Cube's x and then exit
if place_meeting(x,y, hardManCubeObj) //just like in Mega Man III for NES if colliding with Hard Man Cube's object
{x = topManCubeObj.x; exit} //just like in Mega Man III for NES now go to Top Man Cube's x and then exit
if place_meeting(x,y,topManCubeObj) //just like in Mega Man III for NES if colliding with Top Man Cube's object
{x = megaManCubeObj.x; exit} //just like in Mega Man III for NES now go to Mega Man Cube's x and then exit

//Bottom Row
if place_meeting(x,y,magnetManCubeObj) //just like in Mega Man III for NES if colliding with Magnet Man Cube's object
{x = geminiManCubeObj.x; exit} //just like in Mega Man III for NES now go to Gemini Man Cube's x and then exit
if place_meeting(x,y, geminiManCubeObj) //just like in Mega Man III for NES if colliding with Gemini Man Cube's object
{x = shadowManCubeObj.x; exit} //just like in Mega Man III for NES now go to Shadow Man Cube's x and then exit
if place_meeting(x,y,shadowManCubeObj) //just like in Mega Man III for NES if colliding with Shadow Man Cube's object
{x = magnetManCubeObj.x; exit} //just like in Mega Man III for NES now go to Magnet Man Cube's x and then exit



RE: Game Maker and GML thread - Gors - 10-15-2012

What is this topic's objective? Are you just posting GML codes, or is there a question and/or tutorial here? I'm tending towards the latter, so it might be interesting, I guess.


RE: Game Maker and GML thread - Previous - 10-15-2012

I doubt anyone will be able to make use of the posted code oput of its context.

It also isn't the most elegant way to code such a selection. I'm pretty sure MM3 on the NES didn't check for collisions between the selection marker and stage icon to determine the position.

You have nine stages. Easy solution would be to have a variable for the selection with values from 0 to 8 - let us call if selectionVar for fancyness.

Interpret the stage icons like this:

0 1 2
3 4 5
6 7 8

When the selector has been moved, place it at the position of the appropriate stage icon.

To move the selector to the left (<-) you can simply subtract 1 from the current value.

Code:
if ((selectionVar % 3) > 0) {
    selectionVar--;
}

Why I use the modulo operator? To prevent moving from 3 to 2 (middle row to top row) for example. What it does? This:

0 % 3 = 0
1 % 3 = 1
2 % 3 = 2
3 % 3 = 0
4 % 3 = 1
5 % 3 = 2
6 % 3 = 0
7 % 3 = 1
8 % 3 = 2

So the selection will not move when it is on 0, 3 or 6 (the leftmost icons)! Fancy, isn't it?

Move right:

Code:
if ((selectionVar % 3) < 2) {
    selectionVar++;
}

Move up:

Code:
if (selectionVar > 3) {
    selectionVar -= 3;
}

Move down:

Code:
if (selectionVar < 6) {
    selectionVar += 3;
}

Afterwards, in every case independent of the direction, reposition the selection marker:

Code:
switch (selectionVar) {
    case 0:
        x = sparkManCubeObj.x;
        y = sparkManCubeObj.y;
    break;
    case 1:
        x = needleManCubeObj.x;
        y = needleManCubeObj.y;
    break;
    // ET CETERA OKAY ;)
}



RE: Game Maker and GML thread - Phaze - 10-15-2012

sed 's/just like in Mega Man III for NES/'

(You don't really need that on every single line. Just sayin')


RE: Game Maker Games and Problems - Bombshell93 - 01-04-2013

please read the rules,
To my understanding this is a place for game projects with sufficient information, not a help area.
I'd advise game maker community for help with game maker.


RE: Game Maker Games and Problems - Previous - 01-04-2013

We have the GameDev lounge for games-you-are-making-that-don't-need-their-own-thread-yet discussion. We have a QIT section for questions. I'm mergng this into the general GML thread we have somewhere.