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 Professional Discussion / Space Invaders Help

Author
Message
FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 20th Jul 2010 07:19 Edited at: 20th Jul 2010 07:21
Im not doing this for the contest, but just more for the sake of making it But I need some help with it. Basically I need to split up a loop into rows. But if I insert a loop inside of it, it slows it down tremendously, depending on how many loops i do for rows.

I have this, and even that is dropping the framerate because of the for loops.



curWave is the current wave count. I just need a way to split all those circles into rows depending on the current wave.

Heres the full code



Dev team portal Email me to join the dev team!

LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 20th Jul 2010 08:48 Edited at: 20th Jul 2010 16:29
I started to simply suggest using TYPE variables for tracking the aliens or perhaps arrays, but got a little carried away and revised your code so it at least moves the aliens back and forth and down the screen.



Hopefully all of the edits I made will be understood. Bear in mind, that the player's shots are not collision checked; neither are the aliens checked against the player. You'll also have to put in that the player explodes when the aliens reach the bottom of the screen.

I hope you don't mind me asking, but why not just use sprites? Why not use the mouse to move and fire for the player?

Good luck,

LB

So many games to code.......so little time.
FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 20th Jul 2010 17:42
Thanks LBFN! I just kinda started writing code yesterday and this is what came out >.> And I understand most of your code. The parts I dont, I just have to go through the logic some more. But thanks alot!

Dev team portal Email me to join the dev team!

LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 20th Jul 2010 19:28
You're welcome. Good luck with the game.

So many games to code.......so little time.
FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 21st Jul 2010 03:20
Ive been trying to do some line-circle collision but its not working out lol. Im following this:

http://mathworld.wolfram.com/Circle-LineIntersection.html

This is what Ive come up with:



I thought I've followed it correctly, but apparently I'm wrong

Dev team portal Email me to join the dev team!

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Jul 2010 16:05
Can you give an illustration of what you are trying to do.

The fastest code is the code never written.
FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 21st Jul 2010 16:16
Its on that website. Whenever one of my bullets(a line) intersects an alien(a circle) they both need to disappear.

Here:

http://i29.tinypic.com/ruqqnm.jpg

Dev team portal Email me to join the dev team!

LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 21st Jul 2010 19:31
Why not do a 'box' collision? It would be reasonably accurate and would be less processor-intensive. Replace where you check for bullet collision with this:



BTW, the bullets seem really huge by comparison.

So many games to code.......so little time.
FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 21st Jul 2010 23:58
Thanks =] I changed the bullets and the collision to fit it now. Ive added sounds and I think Im gonna make the aliens shoot back too. This is actually a fun project, so thanks for the help!

Dev team portal Email me to join the dev team!

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Jul 2010 01:01
I see you have a solution but just to help you learn from your original code...

You are repeating the same calculations over and over, that only need to be done once:



Login to post a reply

Server time is: 2026-07-25 21:25:18
Your offset time is: 2026-07-25 21:25:18