GameMaker: Click ‘n drag to pan view


Today I'm going to tell a bit about implementing "click and drag to scroll" type of effect in GameMaker. This particular thing is useful for strategy games (and normally bound to middle mouse button), applications (where visible area may exceed available window space), and various mobile games and applications (where visible area may be panned by tapping and dragging the finger).
Effect itself looks like this:

Continue reading

GameMaker: “flawed” AI path finding

In some cases, you may want object's AI to not pick exactly perfect path.

This example demonstrates creation of a basic "flawed" AI, that uses a rather plain method of finding path. Such will still make it reach destination in many cases, but will also allow player to "fool" the AI, making it stuck in dead ends or T-intersections (if player is standing right behind the wall).

To illustrate simplicity of concept, example is largely made in Drag & Drop.


GameMaker: Angular motion

It's like drifting. On a spaceship. In space.

This is an example of managing angular motion in GameMaker.
In turn, that means having angular speed with acceleration, friction, and limitation.
Such can be particularly useful for simulating a more 'smooth' rotation behaviour, when object will not start or stop rotating instantly.
If combined with relatively properly written code for linear motion, this can grant pretty nice behaviour for space games.
Also there's a "trail" effect added, originally just to demonstrate how it works.
Everything is pretty nice and simple.

Download GMK

GameMaker: Animating backgrounds

This simplistic example demonstrates how to cycle backgrounds in a room at a fixed rate, as you would do with images in a sprite.
Obvious advantage of cycling (animating) room backgrounds is that these are handled and drawn by engine, which makes them generally faster than something you can achieve in a short amount of time.
Seen method supports any number of backgrounds larger than zero.

Download GMK

GameMaker: Coins, floating text, basic shop

GameMaker example - coins, floating text, basic shop
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.

Download GMK