getting cryptic compilers errors

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
emily
Posts: 22
Joined: November 9th, 2019, 9:04 pm
Location: Kentucky

getting cryptic compilers errors

Post by emily » April 23rd, 2020, 7:58 pm

Game.cpp
(4.38 KiB) Downloaded 160 times
I'm getting cryptic compilers errors which I'm not sure what they mean

User avatar
AleksiyCODE
Posts: 32
Joined: September 21st, 2019, 8:47 pm

Re: getting cryptic compilers errors

Post by AleksiyCODE » April 23rd, 2020, 8:16 pm

This .cpp file can't be compiled by itself, so i cant see the error you are having. Either Send a screenshot of the error or all .cpp and .h files that you have in the project.
I like ass

User avatar
emily
Posts: 22
Joined: November 9th, 2019, 9:04 pm
Location: Kentucky

Re: getting cryptic compilers errors

Post by emily » April 23rd, 2020, 8:36 pm

ok here it is.
Beginner Tutorial 5.zip
(1.29 MiB) Downloaded 172 times

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: getting cryptic compilers errors

Post by albinopapa » April 23rd, 2020, 9:21 pm

Code: Select all

x = x + vx;
y = y + vy;

if (x + 5 >= gfx.ScreenWidth)
{
	x = gfx.ScreenWidth - 6;
	vx = 0;
}
if (x - 5 < 0)
{
	x = 5;
	vx = 0;
}
if (y + 5 >= gfx.ScreenHeight)
{
	y = gfx.ScreenHeight - 6;
	vy = 0;
}
if (y - 5 < 0)
{
	y = 5;
	vy = 0;
}

shapeIsChanged = false;
if (!(x > 200 && x < 300))
{
	shapeIsChanged = true;
}

if (wnd.kbd.KeyIsPressed(VK_CONTROL))
{
	gb = 0;
}
All this code is living outside of a function because you have an extra } in the Game::UpdateModel function

Your code:

Code: Select all

void Game::UpdateModel()
{
	/***
	* Errata:
	* In Part 3 when we make the gb variable a membeddddr variable,
	* it will maintain its value from frame to frame.
	* So if we don't reset it every frame, then the first time we press CTRL and set it to 0,
	* it will forever after be stuck at 0, which is probably not desired behavior. ;)
	***/

	gb = 255;	//reset gb every frame

	if (wnd.kbd.KeyIsPressed(VK_RIGHT))
	{
		if (inhibitRight)
		{
		}
		else
		{
			vx = vx + 1;
			inhibitRight = true;
		}

	}
	else
	{
		inhibitRight = false;
	}

	if (wnd.kbd.KeyIsPressed(VK_LEFT))
	{
		if (inhibitLeft)
		{
		}
		else
		{
			vx = vx - 1;
			inhibitLeft = true;
		}

	}
	else
	{
		inhibitLeft = false;
	}

	if (wnd.kbd.KeyIsPressed(VK_DOWN))
	{
		if (inhibitDown)
		{
		}
		else
		{
			vy = vy + 1;
			inhibitDown = true;
		}

	}
	else
	{
		inhibitDown = false;
	}

	if (wnd.kbd.KeyIsPressed(VK_UP))
	{
		if (inhibitUp)
		{
		}
		else
		{
			vy = vy - 1;
			inhibitUp = true;
		}

	}
	else
	{
		inhibitUp = false;
	}
}  // <--- FALSE END OF FUNCTION

x = x + vx;
y = y + vy;

if (x + 5 >= gfx.ScreenWidth)
{
	x = gfx.ScreenWidth - 6;
	vx = 0;
}
if (x - 5 < 0)
{
	x = 5;
	vx = 0;
}
if (y + 5 >= gfx.ScreenHeight)
{
	y = gfx.ScreenHeight - 6;
	vy = 0;
}
if (y - 5 < 0)
{
	y = 5;
	vy = 0;
}

shapeIsChanged = false;
if (!(x > 200 && x < 300))
{
	shapeIsChanged = true;
}

if (wnd.kbd.KeyIsPressed(VK_CONTROL))
{
	gb = 0;
}
}  // <---   TRUE END OF FUNCTION
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply