This rather cute-looking example demonstrates creation of 3d-person camera in GameMaker' 3d. And character rotation. And a few other things.
Descriptions and explanations following,
⚂ Always believe in your soul
This rather cute-looking example demonstrates creation of 3d-person camera in GameMaker' 3d. And character rotation. And a few other things.
Descriptions and explanations following,
GameMaker has a built-in keyboard_string
variable that lets you do simple text entry,
but what if you also want a caret
(so that the user can enter/erase text in the middle of the string)?
This is a post about that - a pretty reasonable input field.
Originally posted on Mar 16, 2013 (archive), revised in 2023.
Continue readingIf you've ever disabled casting of shadows by desktop icons in Windows 7 (System - Additional system parameters - Performance), you might have noticed that it's not possible to set actual colour of icon/thumbnail captions.
It is said, that Windows decides that on it's own, judging from image colours (luminance?).
But is it always the right decision?
Probably not. Time to time I get things like these:
However, despite of it being said that this is automatic, there is is a way to influence decision of system on deciding with a colour. And it is actually a simple one.
Continue readingRecently I've been searching for examples of client-server communication in Haxe, however could not find anything specific. After some search and asking around, I was pointed to sys.net.Socket class, but the actual means of usage remained unclear. It was also confirmed to mirror POSIX socket functionality. Indeed it does that, though, given that Haxe implementation uses exceptions rather than return values, usage remained uneasy.
After some experimenting, I've figured a semi-simple way of using "blocking" sockets.
Continue reading
Once in a while you might want to get a resource index out of it's string name, like so:
instance_create(x, y, 'obj_item' + string(irandom_range(1, 3)));
But, resource indexes aren't strings, so that wouldn't work.
You could add indexes into an array, or have a little switch-statement, but take a bit to set up.
So let's see what else you can do about this,
Continue reading
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,
Continue reading
If you are working with GameMaker, you might have wandered, how to make paths similar to standard ones but in 3 dimensions, or how to efficiently draw path of non-1px width, or other things not covered by path functions.
For this reason, I have made the following function:
Continue reading
By user request on Love2d IRC channel, yesterday I've made this nice function to do intersection/collision check between a ray (for clearance, here, a ray is a infinite line with starting point but no end point) and a circle.
Underlying code is fairly simple, though it does not even require understanding to use the function.
Love2d version takes advantage of multi-return values.
Haxe version has slightly longer code due for more optimal implementation of interface.
Download Haxe .hx Download Love2d .love
Snip:
--[[ Does a ray-circle intersection test. Parameters: x1, y1, di - x, y, direction (radians) of ray x, y, r - position & radius of circle Returns: result - whether collision occurred x - collision X y - collision Y distance - distance from ray start to collision point ]] function ray2circle(x1, y1, di, x, y, r) local vx = math.cos(di) local vy = math.sin(di) -- get relative XY of circle (relative to ray origin): x = x - x1 y = y - y1 -- rotate it based on ray direction (as if ray starts at XY=0 and goes at +X): local tx = x * vx + y * vy local ty = x * vy + y * -vx -- clear misses: if (tx < -r) or (ty > r) or (ty < -r) then return false, nil, nil, nil end -- find X coordinate that line hits rotated circle at th = math.abs(math.cos(math.asin(ty / r))) * r -- too far behind if (tx + th < 0) then return false, nil, nil, nil end -- line start is inside the circle: tx = tx - th if (tx < 0) then return true, x1, y1, 0 end -- return true, x1 + tx * vx, y1 + tx * vy, tx end