[ScheduleGMS] Script and Events Scheduler for GameMaker: Studio

GameMaker Marketplace Listing

[Description]

Schedule scripts and any type of event, easily, with a single line of code!

Set schedule timers using steps or seconds. Pass arguments to scheduled scripts without hassle. Pause, resume, cancel, or immediately finish any schedule. Want a schedule to repeat a set number of times? Easy! Want it to repeat endlessly? You can do that, too!

Give ScheduleGMS a go and make things easier in no time!

[Features]

  • Step and delta timing
  • Supports scripts and events
  • Ability to supply arguments to scripts
  • Cancel, pause, resume, or finish schedules
  • Schedule control groups
  • Ability to repeat schedules a set number of times (or endlessly)
  • System-wide and schedule-specific time scale manipulation
  • Persistent room and persistent instance support
  • Useful support functions
  • Documentation and example project

[Code Example]

// Show message box "Hello" after 3 seconds 
schedule1 = ScheduleScript(id, true, 3, ShowMessage, "Hello");

// Call user event 1 after 30 steps
schedule2 = ScheduleEventUser(obj_Player, false, 30, 1);

// Execute mouse event after 5 seconds
schedule3 = ScheduleEvent(id, true, 5, ev_mouse, ev_left_release);

// Set schedules to repeat set number of times
ScheduleSetRepeat(schedule1, 2); // play twice
ScheduleSetRepeat(schedule2, 0); // play infinitely

// Manipulate schedule state
SchedulePause(schedule1);
ScheduleResume(schedule1);

 // Have schedule immediately finish
 ScheduleFinish(schedule2);

Dungeon Drop

Available for Android on Google Play

[Description]
You control Slimey, a puddle of sentient dungeon ooze drawn to shiny gems and crazy speeds. Put your skills to the test. Dodge cold stone floors as you fall endlessly faster in your adventure. How long can you survive the drop into the deep dark dungeon?

[Features]
-Addictive skill-based gameplay
-Carefully crafted tilt controls
-Compulsive gem collecting
-Colourful pixel art visuals
-Retro styled audio
-Online leaderboards
-Achievements
-Stuff!

 

[GameMaker Studio] Blurry Surfaces… Why??

If you use interpolation for your game’s graphic settings, drawing surfaces can appear blurrier than expected. This is due to graphics being interpolated (smoothed out) when they are drawn to a surface, then being interpolated a second time when the surface is drawn to the main view. There is a simple way to resolve this.

When drawing to a surface, interpolation can be temporarily turned off with texture_set_interpolation() and turned back on when you are finished drawing to the surface. The result is a sharper image when drawing the surface to the main view.

/*** DRAW EVENT ***/
// Set the surface for drawing
surface_set_target(mySurface);

// Turn off interpolation
texture_set_interpolation(false);

// Draw stuff to the surface
draw_sprite(spr_StrongBad, 0, 0);
draw_sprite(spr_HomeStar, 32, 100);

// Turn on interpolation
texture_set_interpolation(true);

// Route drawing back to main view
surface_reset_target();

// Draw the surface to the main view
draw_surface(0, 0);

There!
You should now have a much crisper image when drawing with surfaces!

null

[DispatchGMS] Callback Dispatcher for GameMaker: Studio

DispatchGMS_logo

Available on the GameMaker Marketplace

DispatchGMS is a callback dispatcher which allows for greater flexibility when managing custom events or extending existing ones.

Multiple callbacks can be added to a single dispatcher and later executed from a single script call. Each script callback can be supplied up to 13 arguments. Additionally, when invoked, a dispatcher can, optionally, override previously set callback script arguments.

[Highlights]

  • Add or insert multiple callbacks into a single dispatcher
  • Various ways to remove callbacks as needed (callback id, script, target, all)
  • Ability to override script callback arguments when invoking dispatcher
  • Enable/Disable dispatchers or specific callbacks
  • “Dynamic Event” scripts allow you to easily adapt dispatchers to existing object events
  • Check if dispatchers contain a specific script or target instance

[Example Code]

——————
Create Event
——————
// Create new dispatcher and add two callbacks
onMousePress = DispatcherCreate();

// Add callback to dispatcher
DispatcherAdd(onMousePress, id, ShowMessage, “Mouse Button was pressed!”);

// Add second callback to dispatcher and cache returned callback handle
cbAddNums = DispatcherAdd(onMousePress, id, AddNumbers, 2, 5);

// Remove second callback from dispatcher
DispatcherRemove(onMousePress, cbAddNums);

——————————
Mouse Button Pressed Event
——————————
// Execute dispatcher
DispatcherInvoke(onMousePress);

——————
Destroy Event
——————
// Destroy and nullify dispatcher
onMousePress = DispatcherDestroy(onMousePress);

——————-
Room End Event
——————-
// Destroy and nullify dispatcher
onMousePress = DispatcherDestroy(onMousePress);

[GameMaker] Utilizing script_execute();

null

Syntax : script_execute(scr, arg0, arg1, arg2, …);

I can’t help but feel that script_execute() is one of the most overlooked functions in GameMaker. The official docs describe it as a way to “pass a script to an instance in a dynamic way”. Lets take a look at a simple way it can be utilized.

Lets say you wanted to make a “Play” button for your game. You go ahead and create a new object called obj_ButtonPlay. You give it a sprite and put some code in the Mouse Left Pressed event. You’ve also added some extra code to make it switch images when the button is highlighted. It works as you expect.

But now, you need an “Options” button. So, again, you make another button, naming it obj_ButtonOptions. You give it a sprite, and put some code in the Mouse Left Pressed event. You also add some more of that fancy code to make it highlight. But now you realise that you need more buttons; MANY MORE! You continue to make a new object for each and every button in your game.

Using script_execute, I like to avoid needing a different object for each button.
We can create ourselves a single button object and, using script_execute, make it do (virtually) whatever we want it to.

This time, we create an object called obj_UIButton and initialize a variable in its Create Event:

// Create Event
onTouchUp = -1;

Secondly, we add some code to the Mouse Left Released event:

// Mouse Left Released Event
if (onTouchUp != -1)
{
script_execute(onTouchUp);
}

Now, we go ahead and create ourselves a new script called “GameStart” and write the code we need to start the game:

// GameStart()
audio_play_music(bgmAwesomeSong, true);
room_goto(rmBattleZone);

Then create another script called “GameQuit”:

// GameQuit()
GameSave();
audio_stop_music();
room_goto(rmMainMenu);

We can now dynamically create both required buttons and attach these scripts.

buttonPlay = instance_create(320, 250, obj_UIButton);
buttonPlay.onTouchUp = GameStart;
buttonPlay.sprite_index = spr_ButtonPlay;

buttonQuit = instance_create(320, 350, obj_UIButton);
buttonQuit.onTouchUp = GameQuit;
buttonQuit.sprite_index = spr_ButtonQuit;

Now, both of these buttons, created from the same object, will do two totally different things by using script_execute to call the attached script. The base obj_UIButton object can be extended to include the “fancy” selection highlight and other features. Each instance created from the root object will instantly receive these new features without having to make a new object and repeat code.

This is just one simple example. Its not my goal to show you an extensive way to use it but, rather, to simply get you thinking about how it might help you at some point in your development journey. It is one more tool waiting to be used when you need an elegant solution.

null