Update!
I've been very busy these past few days.
1) I have added GameWorld, GameMap, MapWarp structs. GameWorld consists of an array of gamemaps, and a gamemap can have an array of game waprs. These structs do have other information descriping each gamemap such as name, size, tilemap and tileset associated to map. Warps consist of x, y locations on the current map along with destination x,y coordinates on new map that you're warping....OR you can warp to another location on existing map.
2) Game Engine drawing from GameWorld. When the Game Engine inits, it will load up the first map that the player starts off (also place holder is in place for loading saved player state). That same loadmap function gets called when warping to new maps if collision point hit by player. So, i can add remove tiledmaps at will and connect them via warp points.
3) Added NPC, sprite, and state structs. All of which support the foundation of an array of sprites that are contained within a gamemap (as part of the structure in number 1 item). State holds information around an animation state! Yes, you read this correctly. I have built animation sprites function for this starter kit! Each NPC you define its attributes such as name, dialog that it may have, xy location, spritesheet information, and states. Each state contains even its own tic speed. So for example if you have a 4x4 spritesheet but I want all 4 of those states to have different speeds, you will be able to do that.
Below is just another (larger map) i created that map 1 warps to. The silly black square spot on the map is my easy to see warp point back to map 1. I've also adjusted my fader so that theres a nice delay fade between warping maps.
- 28.png (59.64 KiB) Viewed 70972 times
What's up next? I've got a basic AI working now with my loaded NPC's (simple walks back and forth and switches states when he walks left vs right). I'm going to tackle a nicer AI setup that will live within the NPC.c file and possibly a definition within npc.h for basic AI or scripted AI for those scenes that NPC's move to the right so many places then down so many and start doing other animations.
NOTE: One cursed issue that i have currently with my animations is that with my spritesheet i have to have both left AND right states (normally, you'd just have left or right and just flip horizontally within code). But, i am using Yatssd for my drawing sprites as it is suprior to anything I can write and supports horizontal and vert flipping plus scaling and other fun things for sprites. The "But" is that I'm doing things with Vic's code that he never intended for within his demo ... so I cannot even call what i've discovered a bug as it's beyond what he had designed. If i have a stationary sprite that I don't change its state.....all is well i can flip horizontally, vertically, or no flipping at all. Now, if you change state of that drawing sprite (effectively changing the sprite image) and you have either set normal or both (horizontal/vertical flipping) you see artifacts left behind when the animation occurs. Very strange, but easily overcame just by adding that 2nd state for left or right (thus never needing to flip horizontally)
Enjoy everyone!