#4,032 in Computers & technology books
Use arrows to jump to the previous/next product

Reddit mentions of GameMaker Game Programming with GML

Sentiment score: 1
Reddit mentions: 2

We found 2 Reddit mentions of GameMaker Game Programming with GML. Here are the top ones.

GameMaker Game Programming with GML
Buying options
View on Amazon.com
or
Specs:
Height9.25 Inches
Length7.5 Inches
Number of items1
Release dateApril 2014
Weight1.95 Pounds
Width0.79 Inches

idea-bulb Interested in what Redditors like? Check out our Shuffle feature

Shuffle: random products popular on Reddit

Found 2 comments on GameMaker Game Programming with GML:

u/HenryAudubon ยท 5 pointsr/gamemaker

Here's the gist of the state machine implementation I learned from GameMaker Game Programming with GML by Matthew DeLucas.


CREATE EVENT


//state constants, any states you want to have can go here, just assign each one a different number 0-15.

idle=0;

jump=1;

//state machine variables

//track what state you're in. I'm choosing idle to be the starting state.

state_id=idle;

//track whether your current state is different from the state you were in last step.

entered_new_state=true;


STEP EVENT


//temporary variable used for determining if our state has changed.

var current_state = state_id;

//All of the game logic for each state is going to be put into user defined events. The 0th event for idle, the 1st event for jump, etc.

event_user(state_id);

//the code that changes our state is going to be put into the user defined events. This will set entered_new_state to true if our state changed during the user defined event that happened this step.

if(current_state != state_id) entered_new_state=true;


USER DEFINED EVENT 0 (example)


//if we just entered this state, do some stuff...

if(entered_new_state){

sprite_index=spr_player_idle;

image_index=0;

image_speed=0.2;

entered_new_state=false; //turns off this variable so that this code is only run when we've just entered this state.

}

//here you can have any code that you want to happen while you are in this state.


//finally, you put your state transition code at the bottom.

if(keyboard_check_pressed(vk_space)) state_id=jump //jump when we push the space bar.


ALL DONE!

This is a very powerful and flexible system. I'd be happy to answer any questions you may have.





u/Anony_Muss_Trull ยท 1 pointr/gamemaker

I bought this book. It teaches GML extensively:

GameMaker Game Programming with GML by Matthew DeLucas http://www.amazon.com/dp/1783559446/ref=cm_sw_r_udp_awd_.qF3tb0PG407M