The idea behind this effect is simple enough - for every string character that should be randomized, replace it with any other character that has same width (so that the drawn string would not wiggle chaotically).
It uses 3 scripts total - one for general initialization, one for per-font init (creating a map of lists for what glyphs any given one could be replaced with), and one for actual string processing.
Can be handy for various abstract pieces, or as an interesting way to censor text.
Text versions follow,
There are multiple cases where you may want to let user input text in a familiar way, keeping things intact with system settings and allowing minor tweaks like repositioning the text cursor. Such include consoles, chatboxes, input fields, and other. This example covers these needs with fairly short (less than 70 lines total) and fairly understandable code. It includes the following features:
- Keeps track of input text on window focus loss. If you've tried to make an input box before, you may be similar with that unpleasant default behaviour of keyboard_string in GameMaker.
- Allows to reposition cursor (left / right / home / end keys)
- Allows to use Delete key to erase characters
- Can be easily modified to support other keys and shortcuts
Example includes actual input field object, and sample list drawer, to which typed text is sent upon press of Enter.
I do not know the exact name of this visual effect (angular/clockwise fade-in/fade-out?), but it is one of the most common things that you can see in interface of RPG and RTS games, displaying progress of construction/upgrade/ability cooldown. So, to the point...
You can read how this is actually being implemented, or just scroll down to the bottom of post and grab the code and/or GMK file.
Implementation of such is actually pretty simple,
This is an example of a circular ('wheel') menu in GameMaker.
Example is well-commented, easy to configure, and will automatically adapt to given number of menu items.
Among other things, it demonstrates 'binding' of menu actions without using dynamic functionality, making it compatible with GameMaker: Studio.
This example is going to be of great use for everyone making local multi-player games, as well games requiring to display two objects on screen at once generally.
Effect here is, that view is positioned and scaled (if needed), to include two given instances at once.
Example provides a single function that does this sort of trick for you, absolutely painlessly and easily.
This intermediate example demonstrates, how to create a rather nice interface element being an arrow that points between a on-screen object (normally player) and a off-screen location, that needs to be reached. In this case, arrow indicates exact direction to target, and is made to clamp accurately to screen edges (preserving direction vector), to avoid confusion on behalf of player.
Such feature is specifically useful for exploration games, where goal(s) may be at different distance from player, and some guidance is required.
Source code follows,
In the example, 'notifier' is just being annoying on purpose
This is an example for adding smooth-looking slide effect to game's window in GameMaker.
I suppose that ones to use my old program 'GMConverter' might have seen it there.
Despite of simplicity, it doesn't seem to be a common thing to see in games and applications.
Taking low ability of people to understand my original code, this example is well-commented and attempts to simplify usage where possible.
Download Continue reading
Let's just say that art assets for this example are from abstract collection.
While I have made this example a long time
ago, it appears that questions about such still are common, and thus it would make sense to give it a 'searchable form' of post here.
This example demonstrates creation of 3 things:
- Coins, as a basic collectable item.
- Floating text, which is used here to display '+1' on picking up a coin, but has many other uses.
- Shops, as objects that sell you useful (or here, useless) things for coins.
Overall, rather simplistic, however still useful for ones that do not know what they're doing with these.
Today I've made a simple example for strategy-like unit selection.
That is, selecting units (instances) with mouse, with selection rectangle and selected units being displayed accordingly.
Example is well-commented and should be easy to use.
Principle of work is simple - to detect units that overlap selection rectangle, game should cycle through them, performing collision_rectangle checks. Amount of calculations and code complexity is cut here by local variable usage (if you did not know, local variables 'var' will be available inside of with constructions without any prefixes).
Source code follows,
In some cases, a moment comes when you need to display specific content in a area smaller than itself, thus requiring scrolling.
GameMaker does not support 'clip rectangle' type of command for its reasons, however it is easy to 'clip' area to be drawn by using an 'buffer' surface to draw content in, before drawing that to screen.
Attached example illustrates sample implementation of such.
Most often, content of such would be text. And maybe an image. Or two.
Since images would require a bit more code, example does simple and efficient - long long text is rendered into a surface, which is later drawn into an other 'buffer' surface to display it as part of window on screen.
Also there is a scrollbar, which obviously can be improved, if it needs to serve purposes other than displaying position of 'window'.