Overview
One Step from the Vet’s Office is a C++ game using OpenGl in Visual Studio. It’s a rogue-lite game based off of One Step from Eden, created over the course of 2 weeks. The player moves on one grid, and all enemies move on a separate grid. Entities in the game can fire both projectiles and hit-scan attacks. The player moves through several room fights and shops until she gets to the final boss. After the final boss, difficulty scales up on all enemies, and the player can play again.
Implementation
Graphics
The entirety of this game was programmed in C++. Using texture coordinates and screen space, sprites were drawn onto the screen every frame. Animations were created by moving the texture coordinates to select a different sprite in the same image file. I used an enumeration to cycle through the different types of animations, which all units in the game had, and a separate integer for which frame of the animation they were displaying.
// Render the object
void Renderer::render()
{
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, spriteTextureMap);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glBegin(GL_QUADS);
glColor4ub(0xFF, 0xFF, 0xFF, 0xFF);
// Top Left
glTexCoord2f(renderInfo.xTextureCoord * currentAnimation, renderInfo.yTextureCoord);
glVertex3f(renderInfo.xPositionLeft, renderInfo.yPositionTop, 0.0);
// Bottom Left
glTexCoord2f(renderInfo.xTextureCoord * currentAnimation,0);
glVertex3f(renderInfo.xPositionLeft, renderInfo.yPositionBottom, 0.0);
//Bottom Right
glTexCoord2f(renderInfo.xTextureCoord * (currentAnimation + 1),0);
glVertex3f(renderInfo.xPositionRight, renderInfo.yPositionBottom, 0.0);
// Top Right
glTexCoord2f(renderInfo.xTextureCoord * (currentAnimation + 1), renderInfo.yTextureCoord);
glVertex3f(renderInfo.xPositionRight, renderInfo.yPositionTop, 0.0);
glEnd();
glDisable(GL_TEXTURE_2D);
}