Page 1 of 1

need help on gfx game too

Posted: Mon Jun 27, 2005 11:16 pm
by bobdole
Okay i need help on this gfx game i thought that it was pretty good (for a 13 yr old) i cant get the eyes to stop moving at the edge of the screen ,i got the dude to move, oh yeah use the arrow keys to move your guy (blue dude)
could somebody also tell me how to get rid of screen flickering, i wanted to make a background for them but it flickers too much when it runs
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>.
++++++++++++++++++++++++++++++++++++++++++++++++
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CLS
X% = 200
Y% = 146
SCREEN 12
X2% = 190 'left eye x
Y2% = 140 'left eye y
X3% = 210 'right eye x
Y3% = 140 'right eye y

X4% = 120
Y4% = 200


DO
RANDOMIZE TIMER
U% = INT(RND * 3)
T% = INT(RND * 3)
'LINE (10, 10)-(600, 600), 2, BF

CIRCLE (X4%, Y4%), 20, 4 'bad red guy
PAINT (X4%, Y4%), 4 'painted bad red guy

CIRCLE (X2%, Y2%), 3, 2 'left eye
CIRCLE (X3%, Y3%), 3, 2 'right eye
PAINT (X2%, Y2%), 2
PAINT (X3%, Y3%), 2






CIRCLE (X%, Y%), 15, 1

PAINT (X%, Y%), 1

a$ = INKEY$

IF a$ = CHR$(0) + CHR$(72) THEN Y% = Y% - 4
IF a$ = CHR$(0) + CHR$(72) THEN Y2% = Y2% - 4
IF a$ = CHR$(0) + CHR$(72) THEN Y3% = Y3% - 4
IF a$ = CHR$(0) + CHR$(72) THEN CLS
IF a$ = CHR$(0) + CHR$(72) THEN PRINT " Y Ratio"; Y%, " Y2 Ratio "; Y2%, " Y3 Ratio"; Y3%
IF Y% = 18 THEN Y% = 22
IF Y2% = 16 THEN Y2% = 20
IF Y3% = 16 THEN Y3% = 20



IF a$ = CHR$(0) + CHR$(80) THEN Y% = Y% + 4
IF a$ = CHR$(0) + CHR$(80) THEN Y2% = Y2% + 4
IF a$ = CHR$(0) + CHR$(80) THEN Y3% = Y3% + 4
IF a$ = CHR$(0) + CHR$(80) THEN CLS
IF a$ = CHR$(0) + CHR$(80) THEN PRINT " Y Ratio"; Y%, " Y2 Ratio"; Y2%, " Y3 Ratio"; Y3%
IF Y% = 462 THEN Y% = 458
IF Y2% = 452 THEN Y2% = 448
IF Y3% = 452 THEN Y3% = 448


IF a$ = CHR$(0) + CHR$(75) THEN X% = X% - 4
IF a$ = CHR$(0) + CHR$(75) THEN X2% = X2% - 4
IF a$ = CHR$(0) + CHR$(75) THEN X3% = X3% - 4
IF a$ = CHR$(0) + CHR$(75) THEN CLS
IF a$ = CHR$(0) + CHR$(75) THEN PRINT " X Ratio"; X%, " X2 Ratio"; X2%, " X3 Ratio"; X3%

IF X% = 20 THEN X% = 24
IF X2% = 14 THEN X2% = 18
IF X3% = 34 THEN X3% = 38

IF a$ = CHR$(0) + CHR$(77) THEN X% = X% + 4
IF a$ = CHR$(0) + CHR$(77) THEN X2% = X2% + 4
IF a$ = CHR$(0) + CHR$(77) THEN X3% = X3% + 4
IF a$ = CHR$(0) + CHR$(77) THEN CLS
IF a$ = CHR$(0) + CHR$(77) THEN PRINT " X Ratio"; X%, " X2 Ratio"; X2%, " X3 Ratio"; X3%


IF X% = 620 THEN X% = 616
IF X2% = 606 THEN X2% = 602
IF X3% = 626 THEN X3% = 622
IF X% < 160 AND X% > 80 AND Y% > 158 AND Y% < 242 THEN GOTO die



LOOP
die:
PRINT "You Have Died Ya Moron"
END

Posted: Sat Jul 02, 2005 6:27 am
by Ralph
Bob, you did a lot of good work! Congratulations!

I rearranged your code, so that the good guy was drawn and "painted" BEFORE the eyes, so they wouldn't be painted over.

===============================================
Then, I changed these lines:
IF Y% = 462 THEN Y% = 458
IF Y2% = 452 THEN Y2% = 448
IF Y3% = 452 THEN Y3% = 448
to
IF Y% = 462 THEN
Y% = Y% - 4
Y2% = Y2% - 4
Y3% = Y3% - 4
END IF

The above change keeps things well in hand. After all, whatever increase (or decrease) you make in Y% must be made in all parts of the good guy, including his eyes.

I made other similar changes to your program.


As far as the screen flicker, I believe it is due to your CLS statements. They are not necessary, when you unremark your line,
LINE (10, 10)-(600, 600), 2, BF
So, I remarked out those CLS statements, and activated your line,
changing the second 10 to a 20, and I got a nice, green screen, with no flicker.

Your program, as far as you have advanced it, works nicely! As soon as the good guy bumps into the bad guy, your final sentence about the moron is printed at the top, and the program waits for the <Esc> key to be pressed to end.

Here is your program, as I changed it:

Code: Select all

ProgName$ = "Moron" 'I called your program "Moron"
'Okay i need help on this gfx game i thought that it was pretty good (for a
'13 yr old) i cant get the eyes to stop moving at the edge of the screen ,i
'got the dude to move, oh yeah use the arrow keys to move your guy (blue dude)
'could somebody also tell me how to get rid of screen flickering, i wanted
'to make a background for them but it flickers too much when it runs
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>.
'++++++++++++++++++++++++++++++++++++++++++++++++
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CLS
X% = 200
Y% = 146
SCREEN 12
X2% = X% - 10 'left eye x
X3% = X% + 10 'right eye x
Y2% = Y% - 6  'left eye y
Y3% = Y% - 6  'right eye y

X4% = 120
Y4% = 200


DO
RANDOMIZE TIMER
U% = INT(RND * 3)
T% = INT(RND * 3)
LINE (10, 20)-(600, 600), 2, BF

CIRCLE (X4%, Y4%), 20, 4 'bad red guy
PAINT (X4%, Y4%), 4 'painted bad red guy

'draw good guy
CIRCLE (X%, Y%), 15, 1
PAINT (X%, Y%), 1

'draw good guy's eyes
CIRCLE (X2%, Y2%), 3, 2 'left eye
CIRCLE (X3%, Y3%), 3, 2 'right eye
PAINT (X2%, Y2%), 2
PAINT (X3%, Y3%), 2



'a$ = INPUT$(1)'''INKEY$
a$ = "": WHILE a$ = "": a$ = INKEY$: WEND

'up arrow pressed
IF a$ = CHR$(0) + CHR$(72) THEN
  Y% = Y% - 4
  Y2% = Y2% - 4
  Y3% = Y3% - 4
  'CLS
  LOCATE 1, 1
  PRINT " Y Ratio"; Y%, " Y2 Ratio "; Y2%, " Y3 Ratio"; Y3%
END IF

IF Y% <= 18 THEN
  Y% = Y% + 4
  Y2% = Y2% + 4
  Y3% = Y3% + 4
END IF


'down arrow pressed
IF a$ = CHR$(0) + CHR$(80) THEN
  Y% = Y% + 4
  Y2% = Y2% + 4
  Y3% = Y3% + 4
  'CLS
  LOCATE 1, 1
  PRINT " Y Ratio"; Y%, ", Y2 Ratio"; Y2%, " Y3, Ratio"; Y3%
END IF

IF Y% = 462 THEN
  Y% = Y% - 4
  Y2% = Y2% - 4
  Y3% = Y3% - 4
END IF

'left arrow pressed
IF a$ = CHR$(0) + CHR$(75) THEN
  X% = X% - 4
  X2% = X2% - 4
  X3% = X3% - 4
  'CLS
  LOCATE 1, 1
  PRINT " X Ratio"; X%, " X2 Ratio"; X2%, " X3 Ratio"; X3%
END IF

IF X% = 20 THEN
  X% = X% + 4
  X2% = X2% + 4
  X3% = X3% + 4
END IF

'right arrow pressed
IF a$ = CHR$(0) + CHR$(77) THEN
  X% = X% + 4
  X2% = X2% + 4
  X3% = X3% + 4
  'CLS
  LOCATE 1, 1
  PRINT " X Ratio"; X%, " X2 Ratio"; X2%, " X3 Ratio"; X3%
END IF

IF X% = 620 THEN
  X% = X% - 4
  X2% = X2% - 4
  X3% = X3% - 4
END IF

'i remarked out the following line, and added my own below
'IF X% < 160 AND X% > 80 AND Y% > 158 AND Y% < 242 THEN GOTO die
IF (X% - X4%) ^ 2 + (Y% - Y4%) ^ 2 < (20 + 15 - 2) ^ 2 THEN GOTO die


LOOP
die:
PRINT "You Have Died Ya Moron"
'I added the next two lines
PRINT "To quit program, press the <Esc> key"
K$ = "": WHILE K$ <> CHR$(27): K$ = INKEY$: WEND

END