It's actually pretty hard to describe what this does without an image.
Basic use for this would be to create units that cannot shoot backwards without rotating towards angle entirely.
⚂ All takes time
It's actually pretty hard to describe what this does without an image.
Interactive demo. Mouseover to activate, drag planets around.
This is an example of making an instance orbit around other instance in GameMaker.
In contrast to other similar examples (and commonly given advice of the kind), it allows to define orbiting speed in a common way (pixels/frame instead of degrees/frame).
This is accomplished by calculating the distance to orbit' center (from current position), calculating the orbit' length, and thus converting pixel speed to degree speed.
New position is then calculated and instance' speed is adjusted for it to reach it the next frame.
This allows to use direction in collision calculations as per usual.
Overall, the code is simple enough but documented regardless.
Code follows,
Continue reading
A video.
A comparison
This post explains how to replicate GameMaker: Studio's application_surface in older versions.
Doing so is more or less a requirement if you want a scaled window with pixel-perfect rendering and/or do not desire to modify your tilesets (although a tool had been made since to help with this).
Continue reading
In the example, 'notifier' is just being annoying on purpose
That's a video.
How it looks and how it is internally
This example demonstrates how to organize system where some level information is presented as a 2-dimensional array (item data indicating block index), and organize collisions with that.
Could basically say that this is a smaller version of my Terra example. Except simpler, using arrays, and Lite-compatible. As well it does not support truly infinite worlds (has a 32000x32000 limit), but target user is not likely to need that anyway.
Let's just say that art assets for this example are from abstract collection.
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,
Continue reading