Kling Klong - aka Fart-Annoyed

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: Kling Klong - aka Fart-Annoyed

Post by SlevinKelevra » February 18th, 2017, 3:02 am

Added enemies to the game! They spawn every 10 seconds and can fly through bricks. Only a ball can kill an enemy. Each enemy kill guarantees a power up drop. If an enemy collide with the paddle, you lose a life. Maximum number on enemies is 4.
Carpe noctem

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Kling Klong - aka Fart-Annoyed

Post by chili » February 18th, 2017, 6:07 am

Sounds awesome man, can't wait to check it out! Nice job coding up and debugging your sprite blitting routine ;)
Chili

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: Kling Klong - aka Fart-Annoyed

Post by SlevinKelevra » February 18th, 2017, 1:12 pm

Modified and improved a lot of small things, and fixed some bugs.

Most relevant changes:
- laser shots can now kill enemies
- improved power up creation after enemy kills (no useless drops like extraLife and max life etc.)
- level 2 and 3 are swapped (because of their difficulty)
Carpe noctem

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: Kling Klong - aka Fart-Annoyed

Post by SlevinKelevra » February 18th, 2017, 8:54 pm

Added the "super ball" power up, which has its own animation and is really powerful :)
It destroys everything in its way (even "undestroyable" bricks) and bounces only from the walls. I tried to make it really rare, maybe need some refinement still.
Carpe noctem

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Kling Klong - aka Fart-Annoyed

Post by chili » February 19th, 2017, 9:45 am

Haha, looking awesome man. You got the Surface class integrated properly I see.
The animated enemies look cool.

I took a peek into your source code too, looks solid. Very easy follow, overall good style.

Edit --- v

Need more levels :)
Chili

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: Kling Klong - aka Fart-Annoyed

Post by SlevinKelevra » February 19th, 2017, 11:30 am

Thanks Chili! I am pretty satisfied with the game right now. Want to polish it up and refactor the code next. My plans are:
- start screen (with "start game", "exit", etc.)
- different difficulties (ball faster, more enemies, less power ups, etc.)
- more levels :)
- maybe a scoring system

Regarding more levels: I wanted to make the game engine and all the basic functionalities first. Physics, power ups, enemies and stuff should work solid before starting with adding more content.

The problem at the moment is, that it is pretty difficult to "create" a new level (as you can see in the code). I want to code something like a "level creator", which will create a level out of a 2d array like this:
E E E S S S E E E
B B R R B B R R B
S E S E S E S E S
.... where each character corresponds to a particular brick, E = empty, S = solid, etc. This would make new level creation much easier.
Carpe noctem

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: Kling Klong - aka Fart-Annoyed

Post by SlevinKelevra » February 19th, 2017, 5:15 pm

Added a really fancy start screen :) and a simple main menu. Want to tackle the level creator, but cannot work with this fu.... arrays anymore. Will switch to std::vector which will cost some time I guess. The current commit will be the last without vectors.
Carpe noctem

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: Kling Klong - aka Fart-Annoyed

Post by MrGodin » February 20th, 2017, 1:05 am

This is what i do for levels. I have a text file layed out how you have mentioned the read it in like so

Code: Select all

// function from my utils class
static __inline std::vector<std::string> LoadTextFile(std::string filename)
	{
		std::fstream txtfile(filename.c_str());
		assert(txtfile.good());
		std::vector<std::string> text;
		if (txtfile.good())
		{
			std::string str;
			while (std::getline(txtfile, str))
			{
				text.push_back(str);
			}
			txtfile.close();
		}
		return std::move(text);
	}
then read the data like so

Code: Select all

std::vector<std::string> map = Utils::LoadTextFile(filename);
Vec2 pos = {0.0f,0.0f};// whereever you wish to start
float x = pos.x;
for (size_t r = 0; r < rows; r++)
	{
		x = pos.x; /// reset x on every new row
		for (size_t c = 0; c < columns; c++)
		{
			switch (map[r][c])
			{
			case 'E': // letter in textfile
			{
				// add block that is
			}
			break;
			case 'B':
			{
				// add block
			}
			break;
			default:
				break;
			};
			x += tilewidth;// move position per column
		}
		pos.y += tileheight;// move to next row
	}
Just to give you an idea :)
Curiosity killed the cat, satisfaction brought him back

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: Kling Klong - aka Fart-Annoyed

Post by SlevinKelevra » February 20th, 2017, 9:27 pm

Thx MrGodin! My refactoring comes slowly to the end :) Will test your stuff afterwards.
Carpe noctem

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: Kling Klong - aka Fart-Annoyed

Post by SlevinKelevra » February 20th, 2017, 11:56 pm

Refactoring finally done! Now Game.cpp/.h are small again :)
Most of the stuff is done by the klingklong manager class.
- added loading level desings from text file (thanks again to MrGodin for the tip!)
- added some more levels
- added small victory sprite/text

What I plan to do next:
- some nerf to the super ball power up (still too strong)
- adding more cool levels
- improving main menu (continue, restart, etc.)
- adding difficulty levels
Carpe noctem

Post Reply