Jump to content
IGNORED

Valentine's Day Programming Project


BoatofCar

Recommended Posts

Oh ok, I didn't realize that. I was hoping to put this in it:

 

10 GRAPHICS 3
20 SETCOLOR 0,0,15
30 SETCOLOR 1,3,4
40 COLOR 3:PLOT 1,5:DRAWTO 3,5
50 COLOR 3:PLOT 1,6:DRAWTO 3,6
60 COLOR 2:PLOT 4,5:DRAWTO 8,5
70 COLOR 2:PLOT 1,7:DRAWTO 8,7
80 COLOR 2:PLOT 1,9:DRAWTO 8,9
90 COLOR 1:PLOT 4,6:DRAWTO 8,6
100 COLOR 1:PLOT 1,8:DRAWTO 8,8
110 COLOR 2:PLOT 31,5:DRAWTO 38,5
120 COLOR 1:PLOT 31,6:DRAWTO 38,6
130 COLOR 3:PLOT 31,7:DRAWTO 38,7
140 COLOR 1:PLOT 31,8:DRAWTO 38,8
150 COLOR 2:PLOT 31,9:DRAWTO 38,9
and as the boy and the girl came together their respective flags would come together too (my wife is from Thailand. Also, if I put that in I could tell her I at least did some of the program myself :)
Link to comment
Share on other sites

Here's where I put it:


380 GRAPHICS 3

382 SETCOLOR 0,0,15

383 SETCOLOR 1,3,4

384 COLOR 3:PLOT 1,5:DRAWTO 3,5

385 COLOR 3:PLOT 1,6:DRAWTO 3,6

386 COLOR 2:PLOT 4,5:DRAWTO 8,5

387 COLOR 2:PLOT 1,7:DRAWTO 8,7

388 COLOR 2:PLOT 1,9:DRAWTO 8,9

389 COLOR 1:PLOT 4,6:DRAWTO 8,6

390 COLOR 1:PLOT 1,8:DRAWTO 8,8

391 COLOR 2:PLOT 31,5:DRAWTO 38,5

392 COLOR 1:PLOT 31,6:DRAWTO 38,6

393 COLOR 3:PLOT 31,7:DRAWTO 38,7

394 COLOR 1:PLOT 31,8:DRAWTO 38,8

395 COLOR 2:PLOT 31,9:DRAWTO 38,9

396 HISX=78:HERX=170:FLOX=0:FLOMV=0:CATCHES=0

400 FOR I=0 TO 27:POKE 53248+I,0:NEXT I:REM CLEAR COLORS, HPOS, ETC, IN GTIA.


Then I deleted rows 410,420, and 430 to get the right colors. I don't have any movement now though.

Link to comment
Share on other sites

 

Here's where I put it:

380 GRAPHICS 3
382 SETCOLOR 0,0,15
383 SETCOLOR 1,3,4
. . .

395 COLOR 2:PLOT 31,9:DRAWTO 38,9
396 HISX=78:HERX=170:FLOX=0:FLOMV=0:CATCHES=0
400 FOR I=0 TO 27:POKE 53248+I,0:NEXT I:REM CLEAR COLORS, HPOS, ETC, IN GTIA.
Then I deleted rows 410,420, and 430 to get the right colors. I don't have any movement now though.

 

 

I guess I'd have to see your entire listing to figure out what happened. It looks like you had properly wedged the new graphics into the initialization at the right place.

Link to comment
Share on other sites

1 REM HAPPY VALENTINE'S DAY GAME/DEMO

110 GOTO 380:REM GO INIT EVERYTHING

120 REM MOVEMENT AND LOGIC

130 HISX=HISX+ST2X(STICK(0))

140 IF HISX>200 THEN HISX=200

150 IF HISX<48 THEN HISX=48

160 HERX=HERX+ST2X(STICK(1))

170 IF HERX>200 THEN HERX=200

180 IF HERX<48 THEN HERX=48

190 IF FLOMV=0 AND STRIG(0)=0 THEN FLOMV=SGN(HERX-HISX)*3:FLOX=HISX

200 FLOX=FLOX+FLOMV:IF FLOMV=0 THEN FLOX=0

210 IF FLOMV<0 AND FLOX<=HERX THEN CATCHES=CATCHES+1:FLOMV=0:FLOX=0

220 IF FLOMV>0 AND FLOX>=HERX THEN CATCHES=CATCHES+1:FLOMV=0:FLOX=0

230 POKE 53248,HISX:POKE 53249,HERX:POKE 53250,FLOX

240 POKE 77,0:IF CATCHES<1 THEN GOTO 130: REM DISABLE ATTRACT MODE, THEM LOOP

250 REM THE END

260 TARGET=HISX-6:IF TARGET<48 THEN TARGET=HISX+6

270 IF HERX=TARGET THEN GOTO 290:REM MOVING HER TO HIM

280 HERX=HERX+SGN(TARGET-HERX):POKE 53249,HERX:GOTO 270

290 POKE 756,226:REM A LAME FONT TRICK

300 ? " Happy Valentine's Day, Eip!"

310 FOR OUT=1 TO 10

320 FOR I=48 TO 63 STEP 0.125:POKE 708,I:NEXT I

330 FOR I=63 TO 48 STEP -0.125:POKE 708,I:NEXT I

340 NEXT OUT

350 POKE 708,54

360 GOTO 360

370 REM INIT ALL THE STUFF

380 GRAPHICS 3

382 SETCOLOR 0,0,15

383 SETCOLOR 1,3,4

384 COLOR 3:PLOT 1,5:DRAWTO 3,5

385 COLOR 3:PLOT 1,6:DRAWTO 3,6

386 COLOR 2:PLOT 4,5:DRAWTO 8,5

387 COLOR 2:PLOT 1,7:DRAWTO 8,7

388 COLOR 2:PLOT 1,9:DRAWTO 8,9

389 COLOR 1:PLOT 4,6:DRAWTO 8,6

390 COLOR 1:PLOT 1,8:DRAWTO 8,8

391 COLOR 2:PLOT 31,5:DRAWTO 38,5

392 COLOR 1:PLOT 31,6:DRAWTO 38,6

393 COLOR 3:PLOT 31,7:DRAWTO 38,7

394 COLOR 1:PLOT 31,8:DRAWTO 38,8

395 COLOR 2:PLOT 31,9:DRAWTO 38,9

396 HISX=78:HERX=170:FLOX=0:FLOMV=0:CATCHES=0

400 FOR I=0 TO 27:POKE 53248+I,0:NEXT I:REM CLEAR COLORS, HPOS, ETC, IN GTIA.

440 POKE 706,248:REM FLOWER

450 POKE 705,88:REM GIRL

460 POKE 704,136:REM BOY

470 REM SET PM GRAPHICS

480 PMPAGE=INT((PEEK(561)/8)-1)*8

490 POKE 54279,PMPAGE

500 PMMEM=PMPAGE*256

510 P0MEM=PMMEM+512

520 P1MEM=PMMEM+640

530 P2MEM=PMMEM+768

540 FOR I=0 TO 127

550 POKE P0MEM+I,0:POKE P1MEM+I,0:POKE P2MEM+I,0

560 NEXT I

570 POKE 53277,2:REM GTIA PLAYERS ON

580 POKE 559,42:REM ANTIC SCREEN, PLAYERS, 2 LINE P/M RESOLUTION

590 POKE 623,1:REM PRIORITY ALL P/M ON TOP

600 FOR I=0 TO 9:READ D:POKE P0MEM+86+I,D:NEXT I:REM HIM

610 DATA 24,24,0,60,90,24,0,24,24,60

620 FOR I=0 TO 9:READ D:POKE P1MEM+86+I,D:NEXT I:REM HER

630 DATA 24,24,0,60,90,24,60,126,24,60

640 FOR I=0 TO 5:READ D:POKE P2MEM+86+I,D:NEXT I:REM FLOWER

650 DATA 42,28,8,8,16,16

660 DIM ST2X(15):REM CONVERT STICK TO MOVEMENT

670 FOR I=0 TO 15:READ D:ST2X(I)=D:NEXT I

680 DATA 0,0,0,0,0,2,2,2

690 DATA 0,-2,-2,-2,0,0,0,0

700 GOTO 130

Link to comment
Share on other sites

Hi! I thought I'd replied to this long ago--I forgot to enable joystick support on the emulator. Sorry about that. Anyway, thanks to your example and the book Atari Player-Missile Graphics in BASIC , I'm starting to understand how to create my own PMGs. The subroutines are still hard for me to understand though. It seems like so much work to do before you even start, with clearing all the space for the buffer and PMG, the boundary, etc.

Link to comment
Share on other sites

Great stuff BoatofCar :thumbsup:

 

Once you have some routines that you are familiar with then you can re-use these for future projects, the first ones are always tougher. I'd keep with the BASIC, then have a look at Turbo BASIC then go onto assembler, why miss out? I find programming very enjoyable. Read through a bunch of the old magazines too (atarimania has them), come back to them from time to time, as articles/programs that you may skip over to start with become relevant as your skills improve :)

 

Hope to see you put an entry in the 10 Liner contest ;)

Link to comment
Share on other sites

The book Atari Player-Missile Graphics In BASIC is the one I like (there are some typos though). You can match this up with the lines you have in your program above. Perhaps for the contest you could make a 10 line version of your game ;)

 

>>>

OVERVIEW OF PMG SETUP

Here are the major programming tasks needed to set up PMG. (Don't try to understand all this right now. It's just an overview. Details will come later.)

  • Design the graphic images you want to display. Then
    calculate the data needed in memory to produce these images.
  • Allocate space in memory for PMG.
  • Dimension strings that will hold player image data.
  • Set the PMG memory to zero data.
  • Read the player image into the player image strings.
  • Set the color of the players.
  • Tell Atari where the PMG memory starts.
  • Tell Atari whether you want single- or double-line resolution.
  • Turn on PMG.
  • Set the initial position coordinates for players and missiles.
  • Animate the players and missiles as desired.

<<<

Link to comment
Share on other sites

New question! Is it possible to draw a PMG in more than one color? For example, if I wanted to draw the flag as Player 3, how would I do that? In the PMG for Atari BASIC, the only thing they mention is that it's possible to layer colors on top of each other to get new colors, but I don't need to do that.

Link to comment
Share on other sites

To make the flags into players you'll need larger players.

This: http://en.wikipedia.org/wiki/CTIA_and_GTIA#Player.2FMissile_Size_Control

explains the size choices. This does not increase the data per player. It just makes the data take up more horizontal space on screen.

 

Each player is one color. If you want multiple colors you need to use multiple players.

 

An option is available so that the overlapping colors of two players' pixels generate a third color (binary OR'd value of the two players' colors result in a third color.)

This: http://en.wikipedia.org/wiki/CTIA_and_GTIA#PRIOR_.24D01B_Write

explains the Multi-Color player option of the PRIOR register. Like the color registers for P/M and playfield graphics this has an OS shadow register, at 623, so make changes to that location rather than the hardware register.

 

and the fourth option is to use a Display List Interrupt to change the color at different vertical positions. Where there are horizontal stripes, DLIs can work well. Mixing multiple colors on the same horizontal line means you need to (also) use one of the choices above.

Link to comment
Share on other sites

Not finished yet :( I'm still working on animating the flags, so this is going to turn into a birthday gift (her birthday is in April, so I'm hoping to have it finished by then.)

 

Generally, pixel animation is hard in BASIC, because it needs a lot of bit crunching (Atari BASIC lacks those operations), and more work to do means more speed is needed. However, using graphics mode 3 as you are doing means fewer pixels are needed and BASIC could be fast enough to make a reasonable animation of the flags' movements by drawing new flag parts as needed and deleting the old.

 

Alternatively, the flags could be animated using a custom character set. It would mean redrawing a lot less information, but the size of the steps of the motion would be the size of a character on screen. The workaround for this is redefining characters to show the flag partly moved, and cycle through the characters.

Link to comment
Share on other sites

Thanks, Ripdubski!

 

I'm still thinking about the most effective way to move my flags across the screen (I am holding off on custom character sets for now, but will probably return to them when I more fully understand basic PLOT commands.

 

Right now, I'm trying to find a way to "automatically" move a dot across the screen:

 

100 GRAPHICS 3
200 COLOR 1
300 FOR I=0 TO 19
400 COLOR 1:PLOT I,1
500 FOR N=1 TO 200:NEXT N
600 COLOR 0:PLOT I,1
700 FOR N=1 TO 200:NEXT N
800 NEXT I
Now, how would I do the FOR loop to move a dot from right to left? I assume there'a way to get a FOR loops to count "backwards" or something?
Link to comment
Share on other sites

Now, how would I do the FOR loop to move a dot from right to left? I assume there'a way to get a FOR loops to count "backwards" or something?

 

Yes - you will do:

 

FOR I = 100 to 0 STEP -1
NEXT I

 

The step can be any value you want to count by, but it has to be a negative value for going backwards.

Link to comment
Share on other sites

No you need the loops nested inside each other - put them on separate lines for now and it will be easier to follow.

Remember you can use a variable inside a loop to move something else :)

[or additional computations without the FOR, so "J=15-I" etc]...

 

Inside your example "I" is the outermost loop but only after it gets to 9 then you are decreasing "J"! So J is fixed until I has completed - you will probably get an error when the Next I is encountered... (I haven't run your code)

Link to comment
Share on other sites

So I've exploded it out a bit:

 

100 GRAPHICS 3
200 FOR I=5 TO 9
250 COLOR 1:PLOT I,1
251 FOR N=1 TO 200:NEXT N
255 COLOR 0:PLOT I,1
260 NEXT I
300 FOR J=14 TO 10 STEP -1
350 COLOR 2:PLOT J,1
355 FOR N=1 TO 200:NEXT N
360 COLOR 0:PLOT J,1
370 NEXT J
How can I run both loops simultaneously?
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...