Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Astroids
#1
Hello all

Its been awhile since I coded anything in Qb or even posted here. I was just lurking around here yesterday (from work :wink: ) and saw Neks space invader compo. I thought that would be an awesome way to get back into qb. I sat down this evening and spat out a funky engine, only to remember that space invaders is very different to the engine I had just coded, Astroids!
What the hell, its been so long I thought Id share it.
It uses RelLib for key handling and a buffer (Rel, theres a problem with RelBox when compiled (ran fine in IDE). comment out the RelLineH call in the sub updateRoid to see what i mean!! PM me if you need to..)
It took me no more that 1h30 to code so dont be too hard on it, once I realized it was the wrong game (doh!) I didnt refine anything.

Heres a linky http://www.geocities.com/yourfriendthefr...troids.zip

[EDIT] remember kids, geocities dosnt support external linking and neither should you. *stern look around room*, so just right click and save as..... Big Grin

PS. how do you do 2d rotations without getting those nasty missing pixels?....
Reply
#2
The way around. Instead of taking the original image pixels and calculate their new rotated position, you scan the resulting image and look for pixels in the original one. Kinda puzzling, but makes sense: let's say your result image is 32x32, so you just iterate accross the destination, empty image (the two loops for x, y), and give each pixel's location you look for the corresponding pixel in the original image using inverse functions. You don't get holes that way.

The easy way, which produce holes, is what we all know: we iterate accross the original image, and we use SIN and COS to calculate the new position, then plot the pixels:

newX = X * cos (alpha) - Y * sin(alpha)
newY = Y * cos (alpha) + X * sin(alpha)

(or something like that, can't remember exactly Tongue 5:42 AM, six drinks, you know Wink)

What you should do is the way around, i.e. you have newX and newY and you have to find X and Y.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#3
thanks for the reply nath (and ONLY nath.....*rude comments about rest of crowd under my breath*). I think i understand what your getting at with the rotation thing, but im not at a computer that i can code on now. could you give some code/pseudo code for it?

And for the rest of you, is it that bad that there are no comments. I know im an idiot for not coding the right game but its fun. my high score is like 4000ish.
Reply
#4
Hey we just didn't reply cause Nate didn covered it all. And it was unnessarly, nice game though.

Ummm...Nate DID give you the pseudocode for it. :roll:

Here:
1. do
2. draw image using new x + y
3. set old x + y = new x + y
4. get rotation value (angle theta, Nate I thought it was theta, not alpha)
5. put rotation through the formula (using old x+ y) Nate gave you to get the new x + y
6. wait
7. erase image with the old x + y coordinates
7. loop

That's basically it.
i]"But...it was so beautifully done"[/i]
Reply
#5
Quote:thanks for the reply nath (and ONLY nath.....*rude comments about rest of crowd under my breath*). I think i understand what your getting at with the rotation thing, but im not at a computer that i can code on now. could you give some code/pseudo code for it?

And for the rest of you, is it that bad that there are no comments. I know im an idiot for not coding the right game but its fun. my high score is like 4000ish.

:???: Eh? Look at it like this,

no replies, no1 is intrested...
1, well, some1 liked it....
2 - 4: May have a bad code, or 4 ppl liked it...
4 - up: Well, either well liked, or big prob with code....
Over 20+: Depending on post times, can amont any thing....

Replies can be good, replies can be bad... you really shouldn't be upset if no1 posts.... :wink:
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#6
It was quite good, "Begins nit picking"

I had a ASTEROID appear infront of me and move before i could do anything, i died (i had cleared the screen of asteroids so new ones formed), problems like this happen all the time in games, (i was playing a flash sonic once and my charecter caught himself on a spike, fell back and caught himself on the SAME spike, fell back agian, caught himself on the SAME spike AGAIn and died, compared to this the asteroids forming in annoying places every now and again is nothing)
url=http://www.sloganizer.net/en/][Image: style4,TheDarkJay.png][/url]
Reply
#7
A suggestion....LEARN bsave + bload + USE ASTRIOD PICS!!! Big Grin
i]"But...it was so beautifully done"[/i]
Reply
#8
A common problem with Asteroids games is not knowing when to respawn the player ship after you lose a life. That one detail alone is what seperates the average attempts from the professional attempts. Even the old Atari 2600 version of Asteroids never respawned your ship on top of an asteroid. Big Grin

Mitth, I think that the pics idea is completely subjective...he might not want to use pictures... Big Grin
I'd knock on wood, but my desk is particle board.
Reply
#9
I know how to bload. Its been so long since i posted that i look like a complete noob. the original asteroid ship was a triangle mitth, bloading and image would be a waste...

It was made in like 90 min without playing the original (well, microsofts version) in about 5 years, so i was kinda just messing around. I think i might make a proper clone with hyperspace and everthing if i get time. its that or a actual space invader game for your compo ado.
talking about si, i found a cool clone written in qb thats sooo close to the original, i try find the link again and post it.
[EDIT]
linky...
http://www.pixeleye.de/spaceinvaders/clo...v78-02.zip
Reply
#10
hey, I just think that astriod pics would be better than squares....:roll:

Big Grin Hey, and to not respawn on top of an astriod, just use your collision dectecting routine to determine of the entry point in question is occupied by a square or not :roll:
i]"But...it was so beautifully done"[/i]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)