Page 1 of 1

first graphic based....game?

Posted: Wed Dec 19, 2007 8:03 pm
by Andrew Dance
Yeah, its not really a game more than it is a test of my skills that i learned in the last day...

I know that its slow and skips a lot and crappy as hell, but its good enough for me because at least i understand DATA, DIM, GET, and PUT.

help as to why its skippy (and im sure it's because of the CLS every time you move) is greatly appreciated, because i like my little Bobby Blobby :3 and i want to turn him into a full fledged game eventually lol.

here's the source

edit: hmmm..i seem to of lost somehow my working version...strange.

Code: Select all

'blob facing rght
DATA 00,00,10,10,10,00,00,00,00
DATA 00,10,10,10,10,10,10,00,00
DATA 10,10,10,10,10,01,10,10,00
DATA 10,10,10,02,10,10,10,10,10
DATA 10,10,10,10,02,02,02,10,10
DATA 00,10,10,10,10,10,10,10,00
'blob facing left
DATA 00,00,00,00,10,10,10,00,00
DATA 00,00,10,10,10,10,10,10,00
DATA 00,10,10,01,10,10,10,10,10
DATA 10,10,10,10,10,02,10,10,10
DATA 10,10,02,02,02,10,10,10,10
DATA 00,10,10,10,10,10,10,10,00
'facing down sprite
DATA 00,00,00,00,00,00
DATA 00,00,10,10,00,00
DATA 00,10,10,10,10,00
DATA 10,10,10,10,10,10
DATA 10,10,10,10,10,10
DATA 10,01,10,10,01,10
DATA 02,10,10,10,10,02
DATA 10,02,02,02,02,10
DATA 00,10,10,10,10,00

SCREEN 7
CLS
COLOR 2, 6

'draw the sprites on screen so they can be stored in memory
FOR Y = 0 TO 5  ' For each row
  FOR X = 0 TO 8  ' For each column
    READ DotColor
    PSET (X, Y), DotColor
  NEXT X
NEXT Y

FOR Y = 6 TO 11  ' For each row
  FOR X = 0 TO 8  ' For each column
    READ DotColor
    PSET (X, Y), DotColor
  NEXT X
NEXT Y

FOR Y = 12 TO 20  ' For each row
  FOR X = 0 TO 5  ' For each column
    READ DotColor
    PSET (X, Y), DotColor
  NEXT X
NEXT Y

'Store the sprites to memory
DIM blobR%(0 TO 8, 0 TO 5)
DIM blobL%(0 TO 8, 6 TO 11)
DIM blobD%(0 TO 5, 12 TO 20)


GET (0, 0)-(8, 5), blobR%
GET (0, 6)-(8, 11), blobL%
GET (0, 12)-(5, 20), blobD%


CLS
bx = 50
by = 50

PUT (bx, by), blobR%

A$ = INKEY$

DO
	IF A$ = "d" THEN
		CLS
		bx = bx + 2
		PUT (bx, by), blobR%
	END IF

	IF A$ = "a" THEN
	       CLS
	       bx = bx - 2
	       PUT (bx, by), blobL%
	END IF

	IF A$ = "s" THEN
		CLS
		by = by - 2
		PUT (bx, by), blobD%
	END IF
LOOP






go crazy.

-Andrew

Posted: Wed Dec 19, 2007 10:20 pm
by Nodtveidt
The flicker is, of course, a result of the CLS. You're using SCREEN 7, which means you can always use screen pages. Look up how to do this in the QB help, it gives a pretty good explanation.

One suggestion I have for you: if you're going to use INKEY$, don't try doing $$$ against INKEY$ itself. Instead, create a variable and do it like this:

Code: Select all

A$ = INKEY$
IF A$ = "d" THEN
' your code here
etc etc etc.

Posted: Wed Dec 19, 2007 10:37 pm
by Andrew Dance
Nodtveidt wrote:The flicker is, of course, a result of the CLS. You're using SCREEN 7, which means you can always use screen pages. Look up how to do this in the QB help, it gives a pretty good explanation.

yeah, i stumbled across the pages tutorial right after i posed this, and removed the flickering.

As for the buggy controls, im hoping what you said will help, using the variable and all.

Re: first graphic based....game?

Posted: Thu Dec 20, 2007 12:16 pm
by Mac
Andrew Dance wrote:here's the source
I only see a bit of the source.

Mac

Re: first graphic based....game?

Posted: Thu Dec 20, 2007 1:22 pm
by Andrew Dance
Mac wrote:
Andrew Dance wrote:here's the source
I only see a bit of the source.

Mac
its all there

it ends with the

Code: Select all

END IF

Posted: Thu Dec 20, 2007 1:29 pm
by sid6.7
your last DO has no LOOP...how do you want it to go?

Posted: Thu Dec 20, 2007 3:02 pm
by Andrew Dance
sid6.7 wrote:your last DO has no LOOP...how do you want it to go?
ok, that is just a typo, lol. its fixed now, and i edited the code box in the first post to match what it is now.

Posted: Thu Dec 20, 2007 5:28 pm
by Lachie Dazdarian
Would you consider please changing your bloated avatar?

Posted: Thu Dec 20, 2007 8:25 pm
by Andrew Dance
Lachie Dazdarian wrote:Would you consider please changing your bloated avatar?
if you have a problem with my avatar, PM me, don't crap up a thread with irrelevant things. its under 150x150 so whats the big deal?

Posted: Thu Dec 20, 2007 11:51 pm
by BDZ
Andrew Dance wrote:
Lachie Dazdarian wrote:Would you consider please changing your bloated avatar?
if you have a problem with my avatar, PM me, don't crap up a thread with irrelevant things. its under 150x150 so whats the big deal?
Avatar rules as stated right above where you upload an avatar:
Only one image can be displayed at a time, its width can be no greater than 80 pixels, the height no greater than 80 pixels, and the file size no more than 6 KB.
I daresay 149 pixels is greater than 80 pixels, and as amazing as Rumsfield folding a crane is, it's a whole lot larger than 6 KB.

Posted: Fri Dec 21, 2007 12:10 am
by Nodtveidt
That rule only applies to images uploaded to the server. His avatar is remotely linked and therefore isn't forced to conform to the avatar ruleset. 150x150 is the generally accepted standard for forum avatars across the web, it's considered bad netiquette to use larger images.

Posted: Fri Dec 21, 2007 9:50 am
by BDZ
Whoops, my bad...sorry Andrew...