Jump to content
IGNORED

Animated Arrows Using Playfield Pixels


Primordial Ooze

Recommended Posts

I'm not sure what your question is? Are you asking what would be the best way? It completely depends on what else will be going on with the playfeild.

 

If you'll only be used the playfield for the arrows then I'd say you should use the PFHEIGHTS option and squash all 11 pfrows into the top third of the screen.

Link to comment
Share on other sites

Actually the arrows will go horizontal towards the left on the bottom. Could you please provide some sample code? Also could you explain how i would move the "arrows" using many pfpixils and the x,y coordinates?

 

Well, I've been doing a little work with animating Playfield pixels lately. You might want to look at some of the code I posted here for ideas. It's sort of commented :D

 

Basically, I think you are going to attach a variable to the pfpixel command to mark the "tip" of your arrow, then use a series of pfpixel commands (or pfhline/pfvline) to form the shape, size and direction of your arrow.

 

If you look at my code and have any questions, feel free to ask.

 

Cheers!

Jarod.

Link to comment
Share on other sites

Yes:

   rem 2600 Dance
  rem a beat game for the 2600
  rem Updated: October 11, 2008
  rem Website: http://26002600revolution.110mb.com

  rem includes
  
  rem 6 lives kernal
  include 6lives.asm
  
  rem setup all the game variables

  rem variable to hold if new note direction should be randomly generated
  dim generaterandomarrow = a
 
  rem variable to hold note direction
  dim arrow1direction = b
  
  rem arrow 1's x position
  dim arrow1x = c
  
  rem arrow 1's x position
  dim arrow1y = d
  
  rem variable to hold the players combo
  dim combo = e
  
  rem variable to hold how many more combos before the player earns an extra life
  dim extralifecombo = f

  rem set the rom size
  set romsize 2k
 
  rem set the tv format to NTSC
  set tv ntsc
 
  rem turn on smartbranching
  set smartbranching on

  rem kernel options
 
  rem enable no blank lines
  set kernel_options no_blank_lines

  rem set the color of the background to black
  COLUBK = 0
  
  rem set the playfield color to red
  COLUPF = 66
  
  rem set the color of the score to light purple
  scorecolor = 116
  
  rem set the life color to red
  lifecolor = 64
  
  rem set the life bar to compact
  dim lives_compact=1
  
  rem enable the "High Definition" playfield hack
  rem pfscroll upup : pfscroll upup

  rem define the bar sprite
  player0:
  %10000001
  %10000001
  %10000001
  %10000001
  %10000001
  %10000001
  %10000001
  %10000001
  %10000001
  %10000001
  %10000001
  %10000001
end
  
  rem color table for the lives bar
  data colortable
  0,64,66,20,22,200,202
end

rem start a new game

startNewGame

rem start the player with 4 bars
lives = 128

rem define the miss counter
lives:
%00000000
%00000000
%00000000
%11111111
%11111111
%00000000
%00000000
%00000000

end

rem reset player's score to 0
score = 0

rem set the players combo to 0
combo = 0

rem set first note's inital x position off screen
player0x = 21

rem set first note's inital y position off screen
player0y = 80

rem set generate randomdirection to ture since we just
rem started a new game
generaterandomarrow = 1

rem set the note's initial direction to 0 (none)
arrow1direction = 0

rem set arrow 1's initial position
arrow1x = 31
arrow1y = 9


gameLoop

rem if the reset switch is pressed, start a new game
if switchreset then startNewGame

rem if generaterandomarrow is true
rem generate a random number to generate
rem an arrow randomly and set arrowdirection
rem to that random number and set generaterandomarrow
rem to flase
if generaterandomarrow = 1 then r = (rand & 3) + 1:arrow1direction = r:generaterandomarrow = 0

continue

rem set note's color to yellow
COLUP0 = 30

rem clear the playfield
pfclear

rem draw arrow 1
pfpixel arrow1x arrow1y on:pfpixel arrow1x arrow1y+1 on:pfpixel arrow1x arrow1y+2 on

rem draw the screen
drawscreen

rem move the arrow
if arrow1x = 0 then  arrow1x = 30 else arrow1x = arrow1x - 1

rem if the player has earned an extra life then give
rem him the extra life and set extralifecombo to 0
if extralifecombo = 50 && lives < 228 then lives = lives + 32:extralifecombo = 0

rem determine how many lives the player has
temp1 = lives / 32

rem set the life bars color based on how well the player is doing
lifecolor=colortable[temp1]

rem if the player misses 3 times it's game over
if lives < 31 then gameOver

goto gameLoop

rem Game Over Screen
gameOver

gameOverLoop
rem if the reset switch is pressed, start a new game
if switchreset then startNewGame

rem if the joystick fire button is pressed start a new game
if joy0fire then startNewGame

rem set note's color to orange
COLUP0 = 62

rem draw the screen
drawscreen

goto gameOverLoop

 

Unfortinately this line is giving me problems:

pfpixel arrow1x arrow1y on:pfpixel arrow1x arrow1y+1 on:pfpixel arrow1x arrow1y+2 on

If i add this after the last one:

pfpixel arrow1x-1 arrow1y on

It produces the error

---------- Capture Output ----------

> "C:\Atari2600\bB\2600bas.bat" C:\Projects\Atari2600\2600DDR\2600DDR.bas

2600 Basic compilation complete.

C:\Projects\Atari2600\2600DDR\2600DDR.bas.asm (1981): error: Syntax Error ''.

bytes of ROM space left

Unrecoverable error(s) in pass, aborting assembly!

 

> Terminated with exit code 0.

Any ideas?

 

26002600Revolution

Edited by Open Source Pong
Link to comment
Share on other sites

If I remember correctly, you can't have too many pfpixels on the same line.

 

And I could be mistaken, but I thought you weren't supposed to do math using pfpixel, pfhline, and pfvline. Shouldn't it be done using something like a temporary variable?

 

So instead of this:

 

  pfpixel arrow1x-1 arrow1y on

 

 

you'd use this:

 

  temp5=arrow1x-1 : pfpixel temp5 arrow1y on

Link to comment
Share on other sites

If I remember correctly, you can't have too many pfpixels on the same line.

 

And I could be mistaken, but I thought you weren't supposed to do math using pfpixel, pfhline, and pfvline. Shouldn't it be done using something like a temporary variable?

 

So instead of this:

 

  pfpixel arrow1x-1 arrow1y on

 

 

you'd use this:

 

  temp5=arrow1x-1 : pfpixel temp5 arrow1y on

 

Yep. You can't do operations inside of a pfpixel/hline/vline. They just want a value (either static or variable).

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...