Page 1 of 1

space taxi for poor people

Posted: April 10th, 2012, 6:33 pm
by x_eqis
Hey Chili,

first of all thank you for your tutorials which I enjoy watching a lot. I'm a total beginner in programming but amazed how quickly one can start trying out things.

I've written a first little "game" using your poo but not your face. More than 12 seconds of thrilling gameplay guaranteed!

It's got some really lame features which I'm very proud of:

- the player controls a flying x that grows if it eats
- the x bends to the side when moving sideways
- the thrusters are kind of animated
- limited fuel
- a box gets smaller when flown over
- there's gravity and inertia
- the x bounces off the walls

I've attached the sourcecode so if anyone in the forum wants to copy some code - go ahead. Please know I've written it before I saw the lesson with the "DrawLine" function, so that one is missing.

I will certainly keep watching your vids and curious to learn what's next. What I would love to see (besides mindblowing next generation graphics, that is) is some kind of level management or so. Also, it would be great to learn how a game handles sidescrolling and how sounds are embedded.
So keep up the good work,
greetings from germany
xeqis

Re: space taxi for poor people

Posted: April 10th, 2012, 11:03 pm
by Dlotan
Okay here are some tips from me:

1.
Make ur code easier to read by not doing this

Code: Select all

if(this){make this}
instead type it like this

Code: Select all

if(this)
{
     make this
}
2.

Use more white spaces to make ur code easier to read for example
do

Code: Select all

if(x+shipsize/2 > x3-11 && x-15 < x3+11 && y+15 > y3-11 && y-15 < y3+11)
or

Code: Select all

if((x+shipsize/2 > x3-11) && (x-15 < x3+11) && (y+15 > y3-11) && (y-15 < y3+11))
or

Code: Select all

if(x + (shipsize / 2) > x3-11 && 
   x-15 < x3+11 && 
   y+15 > y3-11 && 
   y-15 < y3+11)
instead of this

Code: Select all

if(x+shipsize/2>x3-11&&x-15<x3+11&&y+15>y3-11&&y-15<y3+11)
it wont make ur program slower.

3.
If u got a x and a y coordinate try to use the STRUCT

(HereĀ“s a German site about it http://home.fhtw-berlin.de/~junghans/cr ... truct.html)

4.
If u got varibales like x1,x2,x3... just make an array x[3] or give them names like xspaceship xenemy

5.
Dont draw ur X by every Pixel. Just draw two lines with the function seen in lesson 10

edit: nevermind: saw u said something about this

6.
If u do a { -> make a new line and just 1 tabulator

this

Code: Select all

void Game::drawx2(bool x2hit, int x2, int y2, int r, int g, int b)
{
	
				 if(!x2hit)	 {											//draws 2nd sprite

								for (int k=-15;k<15;++k)
								{	
									gfx.PutPixel(x2-k,y2-k,255-r,255-g,255-b); //X
									gfx.PutPixel(x2+k,y2-k,255-r,255-g,255-b);
								}
							}	
			

}
should look like this:

Code: Select all

//draws 2nd sprite if !x2hit
void Game::drawx2(bool x2hit, int x2, int y2, int r, int g, int b)
{
	if(!x2hit)	 
	{								
		for (int k=-15;k<15;++k)
		{	
			gfx.PutPixel(x2-k,y2-k,255-r,255-g,255-b); //X
			gfx.PutPixel(x2+k,y2-k,255-r,255-g,255-b);
		}
	}	
}
(and always put the comment about what the function does above the function)

7.

Ur function uses Variables, which are already declared in the class... for example

Code: Select all

Game::drawx3 ( x3hit,  x3,  y3);
and the function headline is

Code: Select all

void Game::drawx3 (bool x3hit, int x3, int y3)
u dont need to give these parameters to the function, coz they are already declared in the class

better do it like this

Code: Select all

void Game::drawx3 (bool xhit, int x, int y)
8.

If u call a function which is also declared in the class like

Code: Select all

drawx3 ( x3hit,  x3,  y3);
u dont have to type

Code: Select all

Game::drawx3 ( x3hit,  x3,  y3);
----------------------------------------

It sounds like a lot, what i wrote here. but its a very good start of u. Keep programming

greetz Dlotan (also from good old Germany)

Re: space taxi for poor people

Posted: April 11th, 2012, 12:13 pm
by chili
Bro, I am impressed. Wie geil ist das denn? :lol:
x_eqis wrote:first of all thank you for your tutorials which I enjoy watching a lot. I'm a total beginner in programming but amazed how quickly one can start trying out things.
Thank you too eqis. You're exactly the kind of dude I had in mind when I decided to make these. I'm glad that my tutorials could help you get to the point where you can make something like this on your own. And thanks for posting your code! Seeing stuff like this gives me more motivation to continue the tutorials, and it's good for the other board members too.
x_eqis wrote:What I would love to see (besides mindblowing next generation graphics, that is) is some kind of level management or so. Also, it would be great to learn how a game handles sidescrolling and how sounds are embedded.
Sidescrolling is simple enough, and you could probably figure out a method using what you know already. It will definately come up in a project sometime (probably sooner than later), so you can see how the Chili would handle it then. 8-)

Level management is generally more complex (depending on what you mean by this), and how complex it is depends a lot on the game. It will also come up as a matter of course when I'm teaching other things, but we will need to learn some more language constructs and programming paradigms before we can tackle that problem adequately.

Next generation graphics and sound is much further down the horizon I'm afraid. For graphics, I'm working my way from the basic to the complex, taking the student through the entire evolution of computer graphics almost. This approach will give you an extremely solid foundation once we get to all the modern day hardware-accellerated 3D techniques, but it will take longer I'm afraid. ;) We'll cover sound too at some point (when the fancy strikes me), but it's not a main priority for me.

Anywho, glad to have you aboard bro!

Re: space taxi for poor people

Posted: April 14th, 2012, 12:45 am
by x_eqis
hey chili, hey dlotan,
thanks for your replies. Yes, I also thought my formatting looked like crap when I watched the code. Will try to work on that..
So now I'm up to date with the tutorials. Concerning no.13: Wheeee, that is faster! I had actually been wondering why the screen had built so slowly before. Very nice indeed...

I've worked on my flying-thing-game. Still pretty basic, but at least there are now ennemies and stuff. I attached the code as well as releases with different gravity setting - grav90 is actually more of a jumping game.

One question: Does anyone know whether vst plugins (for music software) are being programmed in c++? I guess if I keep programming, this would probably be my goal for some distant future.

anxious for the next tutorial,
x_equis

Re: space taxi for poor people

Posted: April 15th, 2012, 3:11 am
by chili
I actually had fun trying to beat this game eqis. I like how you rendered the goodies all with vector graphics. Very nice indeed.

I'm going to showcase your game at the beginning of the next video; I hope you don't mind. :lol:

As for the VST plugins, wikipedia says this:
Steinberg's VST SDK is a set of C++ classes based around an underlying C API. The SDK can be downloaded from their website.

...

In addition, Steinberg have developed the VST GUI, which is another set of C++ classes, which can be used to build a graphical interface. There are classes for buttons, sliders and displays etc. Note that these are low level C++ classes and the look and feel still have to be created by the plugin manufacturer.

A large number of commercial and open-source VSTs are written using the Juce C++ framework instead of direct calls to the VST SDK, because this allows multi-format (VST, AudioUnit and Real Time AudioSuite) binaries to be built from a single codebase.
So it looks like C++ is the language to code in if you want to make VST plugins. 8-)

Re: space taxi for poor people

Posted: April 15th, 2012, 8:19 am
by x_eqis
Hey Chili,
of course you may showcase the game if you think it would be helpful..It would be an honour!

Regarding vst: This "wikipedia" page seems to be a real insider tip! ....wanting to say: sorry, next time I'll invest some seconds in a simple internet search before posting such a question on the forum..still I'm glad c++ seems to be the language of choice for vst.

Re: space taxi for poor people

Posted: May 25th, 2014, 2:55 pm
by maxon887
guys it's crashed! Maybe you have some newer version?)))

Re: space taxi for poor people

Posted: May 26th, 2014, 11:56 am
by chili
Hmm, surprised you found this one max. Another blast from the past (has it really been 2 years?) Looking back this is still pretty nicely done. Like the sprites all built with drawline and circle calls. Can't see why it would crash for you though... did you extract the assets folder?

Anyways, eqis peaced out long ago. He did leave all his code though, so it should be easy enough to build this on your machine.

Re: space taxi for poor people

Posted: May 27th, 2014, 2:01 pm
by maxon887
Don't wary Chili. I found this sources and rebuild it shit))) working fine))

Re: space taxi for poor people

Posted: May 27th, 2014, 6:57 pm
by jkhippie
I had trouble with this cause of the screen size ( I think ). I had to put if( x > SCREENWIDTH ) x = SCREENWIDTH; in the putpixel ( and y ) and I got a small rect of the game. Hard to tell what's going on when I can't see it all. Nice sprites, though.