My first game!

Blitz3D Forums/Blitz3D Beginners Area/My first game!

Kirkkaf13(Posted 2010) [#1]
Hi everyone,

I started using blitzbasic roughly 1 week ago, I think I am ready to create my first game.

I would just like to know your opinions of what should be my first game? I was thinking space invaders, what do you think?

I also want to know what sort of level should I develop this game at do I just create a quick working 1 level project with no menu or options or do u reccomend completing the game 100% to how I would like it to run and probably spend afew weeks on doing so if not longer?

- Kirk


xlsior(Posted 2010) [#2]
the real question: what are you trying to get out of it?

Going through the steps to make a full game is going to teach you more than only cherry-picking certain parts, after all.

Of course, especially when your main goal is to learn the language, making everything functional is more important than making everything look pretty.


Kirkkaf13(Posted 2010) [#3]
I obviously want to learn the language and eventually start creating 3D games. I might start with a simple snake game actually because I haven't done any collision detection yet so that might make a good start, what are you thoughts?

- Kirk


_Skully(Posted 2010) [#4]
Snake might be a good way to go to start for sure... but you would need collision detection with space invaders too. You could do something like snake and then later expand on the idea and make a centipede clone... I haven't seen centipede cloned... but it probably has been.


Kirkkaf13(Posted 2010) [#5]
Yeah thanks for this guys, I will start my first game later today (at work at the moment). I am only going to create 1 level (the basic square level because I don't understand how I can implements data command to create my levels so hopfully someone can help me with that when I get there.

- Kirk


PowerPC603(Posted 2010) [#6]
You can start with creating 1 level.
When I started my Arkanoid3D game a month ago, I started with creating 1 level and the creation/placement of the blocks.
Then I added the moving balls and collisions.
After that, I processed the scoring when hitting a block.

When one level was completely functional, I changed the way of how the level was setup, allowing:
- one function is used to load and setup a level
- one function clears everything in the current level
Then I could just load a level, play it and clear everything, then start a new level. All without any memory-leaks.

Finally I created a level-editor with a basic but functional 3D GUI system. A button is just a quad with a texture on it and can be picked, so I can actually click on the button and act on it.

The game isn't finished yet, as it still needs more levels and a nice menu structure, but everything is fully functional.

Most arkanoid clones have a rectangular playfield, but I wanted to be able to create different shaped playfields if needed and kept that in mind. Now the game has that ability.
If you wanna check it out (every line in the code is commented):
http://users.telenet.be/vge/Arkanoid3D/Arkanoid3D.zip


Kirkkaf13(Posted 2010) [#7]
I am having a bit of trouble with keeping the worm (which is a rectangle) moving, I'm bashing my head against a wall here trying to figure out how I can do it. I feel close to solving it and I know its something simple.

Can someone help me here?

-Kirk.


Kirkkaf13(Posted 2010) [#8]
Just after posting I had a brain storm, I knew I was close.

Is this code ok?




PowerPC603(Posted 2010) [#9]
That code looks ok.

Can't test it right now, as I'm at work.


Matty(Posted 2010) [#10]
Seems to work fine.


Kirkkaf13(Posted 2010) [#11]
Hi, I am having some trouble with my worm/snake type program theres a few things I'm not quite sure.

I am using a basic oval shape for food for my snake to eat and a rect (square) for my snake.

I am having trouble with the food using TYPE what fields would I need also to make them a rect appear at random I also only want one appear at a time once 1 is deleted the other 1 is created. I understand how they work just not the logic of how to put it together. I know how I would make my snake speed increase but not how I could increase the snake in length also trailling itself.

If you need to see my source just ask.

-Kirk


Kirkkaf13(Posted 2010) [#12]
Can anyone help?

- Kirk


_Skully(Posted 2010) [#13]
I think the issue is that no one quite knows where to begin here...

but... if your doing what i think you are doing then basically for the snake all you would have to to is move every snake sphere towards its parent sphere with collisions active. Start at the head (because thats where your controls effect) and work your way down the snake...moving each piece up the snake so to speak.


Type SnakeBit
   Field Sphere
   Field Parent.SnakeBit
End Type

SnakeHead.Snakebit=New Snakebit
SnakeHead\Sphere=CreateSphere(8)


The Sphere contains its location in 3d space... gets ya started?


Nate the Great(Posted 2010) [#14]
hey kirk, seeing your source would definitely help as these problems seem to be specific to your code or at least the way you are doing things. Feel free to email me if you want.


Kirkkaf13(Posted 2010) [#15]
Can anyone tell me why this doesn't work and I keep getting an error;
Image doesn't exist?

My image is in the same directory.




Kirkkaf13(Posted 2010) [#16]
Nevermind, my variable wasn't global I guess by default there private.


GfK(Posted 2010) [#17]
The image has not been defined as Global. So you can't use it from within a function.

As you haven't written a game before, I'd recommend Pong - not this. Pong is simple enough for you to get your head around the basics whilst learning new techniques in the process.


Kirkkaf13(Posted 2010) [#18]
Thank you for your thoughts GFK I am not working on a snake game at the minute as I fount out its alittle to hard for me just yet, I am making a game where a ball bounces round 4 walls and you must clicking it to gain points while the ball gets faster as your points increase.

As I havn't done any collision detection yet using images, I need help on collisons using a ball image to bounce of walls in different angles.

Anyone help me here?

- Kirk.


Hotshot2005(Posted 2010) [#19]
there you go

Here the Collisions using Images :)

Const Press_Escape=1

Graphics 640,480,16,2
SetBuffer BackBuffer()

Global Wall=LoadImage("Wall.BMP")
Global Ball=LoadImage("ball.BMP")

DX=1:DY=1
 
While Not KeyDown(Press_Escape)
      Cls      

      DrawImage Ball,X,Y
          
      X=X+DX:Y=Y+DY
	          
      If X>640 Then DX=-DX
      If X<0 Then DX=-DX
	
      If Y<0 Then DY=-DY
      If Y>480 Then DY=-DY

      ; Make one Wall	
      DrawImage WALL,150,200
	
      ; Let make another Wall
      DrawImage Wall,10,300
	
     ; First Collisions of the wall
     If ImagesCollide (BALL,X,Y,0,WALL,150,200,0)
	DY=-DY
     EndIf	

     ; Seconds Collisions of the wall
     If ImagesCollide (BALL,X,Y,0,WALL,10,300,0)
	DY=-DY
     EndIf
	
     Flip
	
Wend


Enjoy it and have Fun :)


Nate the Great(Posted 2010) [#20]
sorry, havent done image based collisions in b3d in a long long time... but for the bouncing effect maybe you could use something like this

have an x and y for position and vx and vy for velocity vector
add vx and vy to x and y every frame
if it hits a wall that is verticle then vx = -vx
if it hits a wall that is horizontal then vy = -vy


Kirkkaf13(Posted 2010) [#21]
Hi everyone,

I have drawn a oval at x and y with width of 50 height of 50. Is there anyway I could click the oval at x, y with left mouse and score = score + 1?

Hope this makes sense.

- Kirk.


Ross C(Posted 2010) [#22]
Your best to draw the oval to an image, then draw the image. That way, you can do an imagescollide() and check the two of them.


andy_mc(Posted 2010) [#23]
If you want to write space invaders, I have a space invaders tutorial on youtube. It's proved very popular so far.
http://www.youtube.com/amcadam26
I've also added videos showing the basics of scrolling backgrounds, particle systems, gravity and some other stuff. Will be adding mroe soon after a long time of not doing much.


Kirkkaf13(Posted 2010) [#24]
Your best to draw the oval to an image, then draw the image. That way, you can do an imagescollide() and check the two of them.



This is a better idea, I guess its better pratice aswell :) thank you.

If you want to write space invaders, I have a space invaders tutorial on youtube. It's proved very popular so far.
http://www.youtube.com/amcadam26
I've also added videos showing the basics of scrolling backgrounds, particle systems, gravity and some other stuff. Will be adding mroe soon after a long time of not doing much.



I have actually watched your space invaders tutorial learnt more about types with it :) I will create a space invaders game after I have completed this one. Thanks alot for your tutorials keep up the good work.

OneHitWonder.


Kirkkaf13(Posted 2010) [#25]
I have drawn the oval to an image I'm still unsure how I could click the image and increase score?

OneHitWonder


Kirkkaf13(Posted 2010) [#26]
Anyone got any ideas how I can implement mouse click on a oval which I've drawn as an image to increase my game score?

OneHitWonder


PowerPC603(Posted 2010) [#27]
You need to use the MouseX and MouseY commands to get the current position of the mousepointer on the screen.
Then check if the coordinates are within the image.
If so, check if the mouse has been clicked using MouseHit.

If all conditions are true (mouse-coordinates are within the boundaries of the image AND the left mousebutton has been clicked), then you've clicked the image.


Nate the Great(Posted 2010) [#28]
well I would suggest using the distance formula to see how far the mouse is from the center of your circle. If its less than the radius then its over the circle.. then test if they hit the mouse button or not. If they did, give them points. :) lol


Kirkkaf13(Posted 2010) [#29]
Hi, I have tried this distance formula and had no luck as I don't know how to write it. I did this:



I manged to get it to work sometimes, when I played around with it I either could click anywhere from the screen or the top left hand side of the oval.

OneHitWonder


Nate the Great(Posted 2010) [#30]
ok you are saying if dist = sqr...

you need to say

dist = sqr bla blah

if dist < radiusofcircle then...


Ross C(Posted 2010) [#31]
it's an oval though so that wouldn't directly work? i still think imagescollide is your best bet to cover all sorts of images. if you create a 1x1 image with a white pixel colour, you can use this as your mouse tip. you never need to draw the image though, just use it as the other image in the imagescollide command, giving the mouses x and y coords as theimages coords.

compare the pointer image to the oval image and your sorted.

if imagescollide(oval_image, x, y,0, pointer_image, mousex(), mousey(),0) = true then
    ;do something
end if