Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Space Invaders Clone.

Author
Message
Not_Maindric
18
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Omaha, NE
Posted: 16th Apr 2008 02:33


What do you think?

Anyway I can make the code better, anything alternate way to do anything? Not finished of course. I have yet to add the enemies.

One question though, when you fire, why does it look like 2 gets fired at once? Only 2 bullets should be showing...

LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 16th Apr 2008 05:40 Edited at: 16th Apr 2008 05:41
Some thoughts:
1. You don't need to clear the screen every iteration of the do - loop. Instead, you could grab an image of the area where your remaining shield level will be printed and then paste this image in that spot - much quicker than a CLS.
2. Sync is best placed at the end of the do - loop to get a fresh update of where everything is at.
3. Why not draw the sprites using a paint program and then load the images or use a bitmap to grab the images? This will be especially helpful when you go to animate the aliens.
4. Moving the bullets 35 pixels every time is a TON. It will likely be difficult to get good collision checking moving them that fast.
5. I would also recommend the following: Declare a sync rate (I usually use around 60 - I know you are using timer based movement), randomizing, setting a display mode and before you get too far along, get the aliens moving the way you want, as this will likely be a more difficult part of the coding.

Quote: "One question though, when you fire, why does it look like 2 gets fired at once?"

Actually, it looks like you are. You have no timer delay when the player fires a shot. Make it so that a certain amount of time has to go by before another shot can be fired.

LBFN
Not_Maindric
18
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Omaha, NE
Posted: 16th Apr 2008 14:51
Quote: "1. You don't need to clear the screen every iteration of the do - loop. Instead, you could grab an image of the area where your remaining shield level will be printed and then paste this image in that spot - much quicker than a CLS."

HM, I shall try this when I get home, sounds better than cls. That also might help other problems.

Quote: "2. Sync is best placed at the end of the do - loop to get a fresh update of where everything is at."

Alright, shall do.

Quote: "
3. Why not draw the sprites using a paint program and then load the images or use a bitmap to grab the images? This will be especially helpful when you go to animate the aliens."

I would, but my goal is to make a media less game. It is just I will feel better about myself if I make a media less game than a media game.

Quote: "4. Moving the bullets 35 pixels every time is a TON. It will likely be difficult to get good collision checking moving them that fast."

That was temporary, I had full intent in changing it.

Quote: "
5. I would also recommend the following: Declare a sync rate (I usually use around 60 - I know you are using timer based movement), randomizing, setting a display mode and before you get too far along, get the aliens moving the way you want, as this will likely be a more difficult part of the coding."

Ah, forgot to put it on this snippet. I removed it temporarily for when I put the timer base in. I put it back in on the main program though not long after posting this. I was going to put the screen display in soon, I know leaving it as is can cause some collision errors. I most likely will also make it 800, 600, 32.

Quote: "
Actually, it looks like you are. You have no timer delay when the player fires a shot. Make it so that a certain amount of time has to go by before another shot can be fired."



Those are just snippets from the above code, but that is a timer based fire rate. I slowed the program down majorly, and it showed it working properly when 5 bullets was max, but every now and then, it shot 2 bullets still. I think it may have something to do with the For...Next statement, but I am not sure.

Thanks for your reply, I shall get to work on this when I get home from school.

LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 17th Apr 2008 01:01
I made a space invaders game that was medialess a while back. I have the code for making the images still if you are interested. I have the player's ship (pretty cool), player's shot, one alien with three images, alien shots with two images and a spaceship with three images.

Let me know,

LBFN
Not_Maindric
18
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Omaha, NE
Posted: 17th Apr 2008 01:46
Hm, if you can, can I get the alien ship and bullets? I would greatly appreciate it. Preferably the codes, thanks if so.

LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 17th Apr 2008 02:45
Okay, here you go:

Set this up early in the code:


Here is the code to store the color info:


Here are the subroutines to make the images. I included the player's ship (blaster). You can simply delte it if you want.


Hope it helps,

LB
Not_Maindric
18
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Omaha, NE
Posted: 17th Apr 2008 03:53
Thank you for the snippets. I like them, and if you do not mind, I am editing them quite heavily.

LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 17th Apr 2008 04:46
I don't mind at all, you can do as you would like.

Good luck on your game.

LBFN
Not_Maindric
18
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Omaha, NE
Posted: 17th Apr 2008 14:22
I should be showing version 0.2 soon. Once I remove a few bugs, smooth the game play a bit, and place the AI, I shall release it.

Not_Maindric
18
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Omaha, NE
Posted: 18th Apr 2008 03:44 Edited at: 18th Apr 2008 04:27
I know I should not double post, but I was just letting you all know that I have Version 0.15 done. Once I fix a very annoying glitch, then it will be 0.2.




The glitch is, even though I hide the sprite, it is still where it dies, and it makes the bullet go bye bye, so it stops early. But, when I use "Delete Sprite..." Then the ship stays there....

Login to post a reply

Server time is: 2026-07-06 13:34:50
Your offset time is: 2026-07-06 13:34:50