Okay, I stuck with what I had for the waypoint system. It works fine so figured why spend the time.
I am interested in experimenting with the tweening system in AGK2 at some point though. I was thinking about making a variation of the waypoint system that used that but I don't think anything would really be gained from doing so. Could be wrong. I will do some experiments another time.
Anyway, let's get on with this update. The waypoint system for the enemies is quite simple as you can imagine.
There are tiles defined to create 2 different paths. If more than 2 are needed in any one area (which certainly they would be in a real game) just create more tiles for those paths.
Defining paths is easy enough. In the Tiled WorldMapOnlyForDesigning.tmx map there is a new layer for setting waypoints. Just set the waypoints as needed. As always, any changes to the Tiled tmx map need to be copied from the WorldMapOnlyForDesigning.tmx file over to the WorldMap.txt file actually used by the program.
A new file PathManager has been added
This file declares two new types
type TWaypoint
active as integer
xp as float
zp as float
endtype
type TPath
active as integer
lastNodeID as integer
waypoints as TWaypoint[MAP_PATHNODES_MAX]
endtype
and a new global of TPath is declared
global MapAreaPaths as TPath[MAP_PATHS_MAX]
The MapManager file has been updated to process the new layer and populate this MapAreaPaths array. So pretty simple stuff. We have a node (waypoint) type and each TPath has an array of waypoints.
The PathManager has various functions to make working with the waypoint system simple.
And of course there is now an EnemyManager file that handles updating the enemies and uses the PathManager as needed to navigate from waypoint to waypoint. Following the same pattern, the array of enemies is populated in MapManager.
And of course the DeactivateArea function in MapManager has been updated to handle deactivating paths and enemies.
I also updated various other bits in the code. Player movement is no longer under a timer. This makes movement smoother and works better at very low framerates. Turning is still under the timer because we need that coarse turning since it is via keyboard control and makes it much easier to aim the player where we want them to go.
I made a slight change to the lighting, fixed a few places in the code that did not take the FrameTimeScale into account and so forth. I also worked on improving the impact FX of the fireballs hitting objects to make it more noticeable. Overall as usual it has some new stuff and the old stuff is a bit better.
I want to have two enemies in here and did the basic work to support that. The two enemy types are slider and hopper. But only 1 (the slider) is actually implemented in this update. The other enemy will just be a different colored cube (and perhaps different dimensions). This second enemy will move by hopping instead of sliding.
That second enemy I will work on in the next session tomorrow night or Monday. I don't know exactly.
Anyway yeah so that is the update this time around.
As usual full source is attached. 90 KB nowTI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)