I've maybe gotten ahead of myself for a little Easter egg that probably no one will care about but it's a fun idea I've been enjoying implementing. That is, I decided it would be fun to add a game within a game and since mine takes place in the late 80s a first-person dungeon crawler on the home PC seems like the kind of thing you would have been playing. I've managed to make it work but it seems unnecessarily labor-intensive and I'm repeating a lot of code that maybe doesn't need to get repeated this way.
In the mini-game room the player switched to a little pixel arrow I use to track the player's position on a little maze I have plotted out. The little pixel arrow is controlled tank style with the arrow keys and moves around a walkable area inside the maze. I track the direction the pixel arrow is pointed as well as its x and y coordinates on the room screen. Then, I use those to display the appropriate background image of what corner or hallway of the dungeon the player would be seeing. Now, I could just do it like this but that's hundreds of permutations even for a relatively short maze. I have the first tile below which I put together as a proof of concept. So, I know enough to get myself into trouble but not really enough to do this in any intelligent way.
Code: ags
As always thanks for your help!
In the mini-game room the player switched to a little pixel arrow I use to track the player's position on a little maze I have plotted out. The little pixel arrow is controlled tank style with the arrow keys and moves around a walkable area inside the maze. I track the direction the pixel arrow is pointed as well as its x and y coordinates on the room screen. Then, I use those to display the appropriate background image of what corner or hallway of the dungeon the player would be seeing. Now, I could just do it like this but that's hundreds of permutations even for a relatively short maze. I have the first tile below which I put together as a proof of concept. So, I know enough to get myself into trouble but not really enough to do this in any intelligent way.
if ((player.x==3)&&(player.y==3)&&(CardinalDirection==4)){ //in the room's repeatedly execute
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawImage(0, 0, 24);
surface.Release();
}
else if ((player.x==3)&&(player.y==3)&&(CardinalDirection==3)){
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawImage(0, 0, 23);
surface.Release();
}
else if ((player.x==3)&&(player.y==3)&&(CardinalDirection==1)){
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawImage(0, 0, 22);
surface.Release();
}
else if ((player.x==3)&&(player.y==3)&&(CardinalDirection==2)){
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawImage(0, 0, 25);
surface.Release();
}
As always thanks for your help!