My Box2D space game (unfinished)

BlitzMax Forums/Brucey's Modules/My Box2D space game (unfinished)

Rico(Posted 2009) [#1]
Hi i put my Box2D game on YouTube (I don't have a website) if anyone wants to see it. I haven't worked on it for a few months now - needed a break. It looks quite basic, but is fun to play! Its not much of a game yet, but you can fly around and shoot stuff - which is always fun. I think it shows some of the things that are possible in Box2D, for anyone thinking of making a game. It was originally a platform game, but it turned into a space game! (with platforms)

http://www.youtube.com/watch?v=5BkTo2sT03Y

(best watched full screen, the video makes it look a bit jerky but it is super smooth normally :) )

Thanks esp to Brucey and Armitage for lots of help and advice. I will probably need some more when I start work on it again! :)


Armitage 1982(Posted 2009) [#2]
Hi

This is crazy !

I like how this increasingly gets loco :) Exploding level, tons of particles, falling crew (lol).

The sound of the ship remind me my old Basic Color 80 or a C64.
With the music is even better.

The "menu" idea is awesome too !

When the badass appear the game gets totaly crazy.


Rico(Posted 2009) [#3]
Thank you Armitage. You and Brucey helped me a lot while making this game :) Yes I like the little men falling out of the ship too, I think it adds some humour to the game. It does get a bit crazy - you can keep on shooting the enemy ship when it is dead - and the men keep coming out!

The game is inspired quite a lot by Space War I suppose. The game does has a rubbish intro and some proper sprites (very rough looking sprites!) so I might make a video with those in too. It has 5 music tracks it can play (all from Neo Geo games cos I love Neo Geo!)

Thanks for the nice comments :)


Brucey(Posted 2009) [#4]
Very cool.
I like the way the enemy ship tracks your every move. A few of those flying around should makes things very interesting indeed :-)
I also thought flying out of the screen was a clever suprise too!

Looking forward to see it develop.


Rico(Posted 2009) [#5]
Thanks Brucey :) The enemy ship AI actually needs improving a lot cos it dosen't fly much like a real person. I will so some pathfinding eventually. In the vid I am always running and shooting, because he is so accurate! a bit like the terminator :) You can actually have a 2 player game at the moment, with one person playing as the rocket. Finished (multiplayer) game will have up to 4 ships on screen on one screen . I might make a scrolling single player game too, with lots of enemies, and destruction.

The flying out of the screen was a bit inspired by Super Mario Bros (1) where you can run behind the score. I always thought that was amazing when I first found that. Its meant to be a secret in my game, but since I spend a while making it happen - I had to put in in the video!


slenkar(Posted 2009) [#6]
how did you get the camera to follow player movements?


Rico(Posted 2009) [#7]
lol. I can't remember. I will look it up for you. I think I just edited the function in the Testbed - there are scale values you can change. I will find out and get back to you.


Htbaa(Posted 2009) [#8]
That seems like an exciting little game. I too was really surprised when you flew out of the boundaries. Neat!


slenkar(Posted 2009) [#9]
yeah it does look awesome


Rico(Posted 2009) [#10]
Thanks Htbaa :)

Hi Jeremy. Ok I did the scaling and camera following by changing DrawSolidPolygon Method in the Render.bmx file (used as standard in box2D examples). My modified function is below. This function is used by all objects so they will all scale around the specified point.

Increase or decrease xScale and yScale to zoom in or out

zm_x and zm_y are the central point of the view, so to follow any object just set these each loop to the objects position.

All variable above are global variables that can be changed in the main program.

You have to do similiar modifications to any other drawing functions and to code that deals with the mouse picking up objects (so it checks the right world position). Hope that helps.

Method DrawSolidPolygon(vertices:b2Vec2[], color:b2Color)
		
		SetImageFont(detailFont)
		SetAlpha 0.5
		SetColor(color.red / 2, color.green / 2, color.blue / 2)
		
		Local poly:Float[] = New Float[vertices.length * 2]
		For Local i:Int = 0 Until vertices.length
	
			poly[i * 2] = ((vertices[i].X() * xScale)+(zm_x*(1-xScale)))-zm_x
			
			poly[i * 2 + 1] = ((vertices[i].Y() * yScale)+(zm_y*(1-yScale)))-zm_y
			poly[i * 2 + 1] = -poly[i * 2 + 1]

		Next
		DrawPoly(poly)
...........etc (rest of function as normal)
	End Method



slenkar(Posted 2009) [#11]
thanks for the code


Jason W.(Posted 2009) [#12]
Excellent work!!

Are you controlling the ship when your are adding more objects to the game? If so, you are extrememly accurate at shooting them :P

Thanks for posting this...very inspiring!!

Jason


Ked(Posted 2009) [#13]
Really cool. I jumped when you crashed through the game wall though.


Rico(Posted 2009) [#14]
Thanks Jason and Ked. I'm pleased you liked it, Yes I am controlling the ship :) It does aim quite nicely.

When I am adding the balls I am holding 'B' down which makes objects bouncy, but it also makes my ship thrust sideways, so thats why the ship moves at the same time. You used to be able to draw objects and platforms in the air, but it wasn't working in this version. I only did that for fun though - the user won't be able to add their own objects in the game!

There's also a video of the terrible intro for the game on my channel. I won't post it cos its a bit embarassing. It does have the game with gfx switched on afterward - but to be honest there is not much difference in how it looks, since they are just rough graphics (was just testing)