Jump to content

Here's a very basic console game I made...

Nineshadow

http://i.imgur.com/c9OqHHP.gifv

 

Why I made it : I've just entered highschool(well...in September, but you know what I mean) and we now have programming and TIC classes. Of course it's very basic, we've mainly worked in pseudocode,but circa a week ago we started porting our code to c++.Nothing serious as you can imagine, just programming problems.We have a homework to make something pretty simple, so why not make a small game,eh?

 

I've done programming in Java before(became quite good at it), and c++ isn't too different.It was just a matter of learning how to make certain things,but only in c++(syntax difference).

 

Download it here : https://www.mediafire.com/?tyqwrb98hrrxp2t   - Updated link,should work even for those who don't have Visual Studio installed.

 

Game help : You're controlling the "@" symbol. Catch as many " * "-s as you can.

Controls : arrow keys to move, esc to quit at any given time.

I haven't added more levels or a goal yet.I'll be working on that(maybe).

 

Note : This is quite ahead of what I'm currently doing at school but hey, why not?

 

Main class:

"item" class :

#include <iostream>#include "windows.h"#include <cstdlib> #include "item.cpp"using namespace std;item g; int score = 0;const int MAP_X = 20;const int MAP_Y = 10; char map[MAP_Y][MAP_X] = {	"###################",	"#@                #",	"#                 #",	"#                 #",	"#                 #",	"#                 #",	"#                 #",	"#                 #",	"#                 #",	"###################"};int x = 1;int y = 1;bool running = true;int main() {	while (running==true) {		system("cls");		for (int display = 0; display < 10; display++) {			cout << map[display] << endl;		}		cout << "Score : " << score;		system("pause>nul");		if (GetAsyncKeyState(VK_DOWN)) {			int y2 = y + 1;			if (map[y2][x] != '#') {				map[y][x] = ' ';				y++;				map[y][x] = '@';			}		}		if (GetAsyncKeyState(VK_UP)) {			int y2 = y - 1;			if (map[y2][x] != '#') {				map[y][x] = ' ';				y--;				map[y][x] = '@' ;			}		}		if (GetAsyncKeyState(VK_LEFT)) {			int x2 = x - 1;			if (map[y][x2] != '#') {				map[y][x] = ' ';				x--;				map[y][x] = '@';			}		}		if (GetAsyncKeyState(VK_RIGHT)) {			int x2 = x + 1;			if (map[y][x2] != '#') {				map[y][x] = ' ';				x++;				map[y][x] = '@';			}		}		if (GetAsyncKeyState(VK_ESCAPE)) running = false;		if (!g.isSpawned) {			int xitem = (rand() % 17) + 1;			int yitem = (rand() % 8) + 1;			g.createItem(xitem, yitem, '*');			map[g.y][g.x] = g.c;		}		if (map[g.y][g.x] != g.c)  { 			g.isSpawned = false;			score++;		}	}	system("cls");	cout << "Game Over." << endl << "Your score was : " << score << endl;	cin.get();	return 0;}
#include <iostream>#include <cstdlib>using namespace std;class item {public :	int x;	int y;	char c = '*';	bool isSpawned;	int getX() { return x; }	int getY() { return y; }	int setX(int a) { x = a; }	int setY(int a) { y = a; }	void createItem(int x,int y,char c) {		item: = x;		item::y = y;		item::c = c;				isSpawned = true;	}};

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

Some dll is missing...

Beware of him that is slow to anger; for when it is long coming, it is the stronger when it comes, and the longer kept. Abused patience turns to fury.
 
Link to comment
Share on other sites

Link to post
Share on other sites

Some dll is missing...

Really?

 

It's just a fucking console project.

Jeez.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

Really?

 

It's just a fucking console project.

Jeez.

MSVCP120D.dll

Beware of him that is slow to anger; for when it is long coming, it is the stronger when it comes, and the longer kept. Abused patience turns to fury.
 
Link to comment
Share on other sites

Link to post
Share on other sites

Same here :/

NingoCase: NZXT H440 White, Motherboard: MSI MPower Z97, CPU: Intel 4790k, Cooler: Corsair H100i (2x Noctua NF-F12) GPU: MSI GTX 970, Memory: 12GB Kingston, SSD: Samsung EVO 120gb, HDD: Seagate Barracuda 2TB, PSU: evga 850 g3

Link to comment
Share on other sites

Link to post
Share on other sites

MSVCP120D.dll

Oh,right...

I've compiled it in Visual Studio. Hang on.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

Nice its a cool little project. Works well.

'Now I am become Death, the destroyer of worlds.'

Link to comment
Share on other sites

Link to post
Share on other sites

Nice its a cool little project. Works well.

Do you have Visual Studio installed?

 

@Laputacake is it working?

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

Do you have Visual Studio installed?

 

@Laputacake is it working?

 

Yeah it works fine mate good job :)

'Now I am become Death, the destroyer of worlds.'

Link to comment
Share on other sites

Link to post
Share on other sites

Do you have Visual Studio installed?

 

@Laputacake is it working?

nah i got msvcp thingie and intalling vcredist didnt help

Steve

Link to comment
Share on other sites

Link to post
Share on other sites

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

works

I gave a debug version and not a release one D:.

Beginner mistake.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

You need to compile your project in release mode(select config from the dropdown box at the top). The D on the end of the DLL name signifies it's debug, so it won't be included in standard Windows C runtime libs.

 

Furthermore, you can forego the use of a DLL by changing the runtime linking under project properties(right click project in the solution explorer and select properties). /MT for release, /MTd for debug. This will statically link the C runtime in your exe.

 

phQdRlP.png

main(i){for(;i<101;i++)printf("Fizz\n\0Fizzz\bBuzz\n\0%d\n"+(!(i%5)^!!(i%3)*3)*6,i);}

Link to comment
Share on other sites

Link to post
Share on other sites

This game reminds me of good old snake on the old nokia bricks

It's not a bug, it's an undocumented feature!

Link to comment
Share on other sites

Link to post
Share on other sites

You need to compile your project in release mode(select config from the dropdown box at the top). The D on the end of the DLL name signifies it's debug, so it won't be included in standard Windows C runtime libs.

 

Furthermore, you can forego the use of a DLL by changing the runtime linking under project properties(right click project in the solution explorer and select properties). /MT for release, /MTd for debug. This will statically link the C runtime in your exe.

 

I've done that already....

The issue has been fixed.

Ty anyway.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

@Avratz is completely correct. Currently, only those with the same version of Visual Studio, as yours, installed (2013), can view it.

Real cool game by the way!

Link to comment
Share on other sites

Link to post
Share on other sites

Upload release version... the "D" in the DLL hits that you've compiled it in Debug and uploaded that instead.

Link to comment
Share on other sites

Link to post
Share on other sites

Upload release version... the "D" in the DLL hits that you've compiled it in Debug and uploaded that instead.

OH GOD DO YOU GUYS REALLY DON'T READ!!

 

 

I'VE UPDATED THE DOWNLOAD LINK.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

OH GOD DO YOU GUYS REALLY DON'T READ!!

 

 

I'VE UPDATED THE DOWNLOAD LINK.

Not when you put the Update annotation after the link.

Put it at the end or start of the post, in capitals like normal person followed by what the update contains ie.

UPDATE:

Aasdadsasdasdadasda

 

You can make full snake game using link lists.

Link to comment
Share on other sites

Link to post
Share on other sites

You can make full snake game using link lists.

That's what I'm currently working on.

Trying to figure out the algorithm.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

I've done that already....

The issue has been fixed.

OH GOD DO YOU GUYS REALLY DON'T READ!!

I'VE UPDATED THE DOWNLOAD LINK.

it's nice to see all this appreciation for the help and informations given

Link to comment
Share on other sites

Link to post
Share on other sites

That's what I'm currently working on.

Trying to figure out the algorithm.

Simply have pointers to "children" nodes, and have function called "setPosition". Use it to move the front node, and have that function automatically call the function of its linked child using the old position till you get to the last one (if(child) where child is a pointer). Update all nodes and viola.

It depends on how you solved your game "field" (you can make separate class that uses single characters as pixels) to update the visuals.

Adding a new node may be a little fiddly when setting up initial position, depends on how you want the snake to behave (expand at the back? - possible issues with edges; sit below the last node and wait for it to move away?)

Link to comment
Share on other sites

Link to post
Share on other sites

it's nice to see all this appreciation for the help and informations given

When I've already fixed an issue and 4 people come and say how to fix the issue that has already been fixed...

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

When I've already fixed an issue and 4 people come and say how to fix the issue that has already been fixed...

(i can't count 4 people)

the first solution even had some insight on what's going on, and tips on the alternatives you have, i thought it could use a proper reply

anyway i just wanted to throw that out there, sometimes i just criticize people on the internet, i'm done now

 

Simply     -do things-

"simplicity" is quite relative. if he's not experienced he may have to think about it a little longer, that's no capital sin

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×