Sooooo i have an error in my code

I highly recommend you learn the basics before attempting a project like this.

1 Like

ok thx

sooooooooooooooooooooooooooooooooooooooooooooooo…

	bool IsKeyDown(int vKey);
			{
				return (GetAsyncKeyState(bKeyDown) & 0x80'00) != 0;
			}

			bool IsKeyUp(int vKey);
			{
				return (GetAsyncKeyState(bKeyup) & 0x80'00) != 0;
			}

			bool isKeyRight(int vKey);
			{
				return (GetAsyncKeyState(bKeyRight) & 0x80'00) != 0;
			}

			bool isKeyLeft(int vKey);
			{
				return (GetAsyncKeyState(bKeyLeft) & 0x80'00) != 0;
			}
			
			// Frame Timing, compensate for aspect ratio of command line
			auto t1 = chrono::system_clock::now();
			while ((chrono::system_clock::now() - t1) < ((nSnakeDirection % 2 == 1) ? 120ms : 200ms))
			{
				if (IsKeyUp(VK_UP))
				{
					nSnakeDirection = 0;
				}
				if (isKeyRight(VK_RIGHT))
				{
					nSnakeDirection = 1;
				}
				if (IsKeyDown(VK_DOWN))
				{
					nSnakeDirection = 2;
				}
				if (isKeyLeft(VK_LEFT))
				{
					nSnakeDirection = 3;
				}

Please stop trying random things until it works. That’s a terrible way to learn anything.

Please read up on functions
https://www.learncpp.com/cpp-tutorial/introduction-to-functions/

ok

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms