Qbasicnews.com

Full Version: Space Invaders!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8
Challenge partly completed:

Code:
DIM UFO(1000), ship(1000), shot(1000)
CLS
SCREEN 7, 0, 1, 0

FOR y = 1 TO 8
FOR x = 1 TO 8
READ shipclr
PSET (x, y), shipclr
NEXT
NEXT

DATA 00,15,15,15,15,15,15,00
DATA 15,15,15,15,15,15,15,15
DATA 15,00,15,15,15,15,00,15
DATA 15,15,15,15,15,15,15,15
DATA 15,15,15,00,00,15,15,15
DATA 15,00,15,15,15,15,00,15
DATA 15,00,15,15,15,15,00,15
DATA 15,00,00,00,00,00,00,15

GET (1, 1)-(8, 8), ship

CLS

FOR y = 1 TO 5
FOR x = 1 TO 9
READ ufoclr
PSET (x, y), ufoclr
NEXT: NEXT

DATA 00,00,15,15,15,15,15,00,00
DATA 00,15,15,15,15,15,15,15,00
DATA 00,15,00,15,00,15,00,15,00
DATA 00,15,15,15,15,15,15,15,00
DATA 15,15,15,15,15,15,15,15,15

GET (1, 1)-(9, 5), UFO

CLS


FOR y = 1 TO 5
FOR x = 1 TO 9
READ shotclr
PSET (x, y), shotclr
NEXT: NEXT

DATA 00,00,00,00,15,00,00,00,00
DATA 00,00,00,00,15,00,00,00,00
DATA 00,00,15,15,15,15,15,00,00
DATA 00,15,15,15,15,15,15,15,00
DATA 15,15,15,15,15,15,15,15,15

GET (1, 1)-(9, 5), shot

CLS

x = 280
y = 10
espeed = 1
playerx = 25
playery = 190

DO
PCOPY 1, 0
CLS
key$ = INKEY$

IF shot = 1 AND sx > x AND sx < x + 9 AND sy > y AND sy < y + 5 THEN
shot = 0
END
END IF

IF shot = 1 THEN
sy = sy - 2
PSET (sx, sy)
END IF

IF e <> 1 THEN
PUT (x, y), UFO
x = x - espeed
END IF
  
IF x <= 20 THEN
espeed = -1
y = y + 9
END IF

IF x >= 280 THEN
espeed = 1
y = y + 10
END IF

IF y >= 200 THEN
PCOPY 1, 0
FOR i = 1 TO 100
PRINT "Game Over"
PCOPY 1, 0
NEXT
END
END IF

IF playerx >= 20 AND key$ = "a" THEN playerx = playerx - 5
IF playerx <= 280 AND key$ = "d" THEN playerx = playerx + 5
PUT (playerx, playery), shot

IF x = playerx AND y = playery THEN
PCOPY 1, 0
FOR i = 1 TO 100
PRINT "Game Over"
PCOPY 1, 0
NEXT
END
END IF

IF key$ = "s" THEN
shot = 1
sx = playerx + 4
sy = playery
PSET (sx, sy)
END IF

LOOP WHILE key$ <> CHR$(27)

END

YES i know there are 2 extra sprites, but i will only have to tweak the code slightly to get it to include multiple sprite
Hopefully I am not too late.. lol
The entry being worked on will be entered representing *Dabooda Team*.

Excellent choice of game, Nek.. lol too bad it wasn't Lolo. lol
Good luck to everyone who has entered..
If everyone else agrees with it (especially Nek), I propose a deadline of April 15th to coincide with the next issue of QB Express.

That way, I can feature all the entries in the issue.

I featured this compo in the last issue, so publishing the results is only natural.
I agree with it.
Really only FreeBASC users stand a chance, qb is too slow and you cannot put like 20 ships easily..

EDIT if you add mine to the issue, you may use it as a "What not to do when programming" example, show the world every problem with my progaramming habits. I wrote it both using n00b methods and i tried to use "Traditional" computer language (relying on 0's and 1's) which backfired and probebly slowed doen the game. I used IF a lot, and i am sure there are MANY other problems with it.
Anyone else gonna enter this competition?

All entries will be featured in the next issue of QB Express!

You have ten days left to get entries in -- they're due on April 15th.
sure, i'll give it a shot... mine's coming ok, but it's got some screen-updating problems unfortunately, i'll figure it out later... darn threads
If no one else submits a game, do i win by default (gets hopes up)?
Quote:If no one else submits a game, do i win by default (gets hopes up)?

*Acts like reporter* So, with the coming April the 15 deadline, how do you feel about your code, that happens to be the only entrant at the moment? Big Grin
If there's only one entrant then whoever entered wins by default. It's not the most prestigious way to win but a win is a win. Big Grin
Pages: 1 2 3 4 5 6 7 8