Jump to content
Sign in to follow this  
graywest

Alternate ways to create player sprites

Recommended Posts

Hello all. I'm fairly new to Batari Basic, but I have played around some. Is there a way to create a variable player sprite? Basically, I would like to create enemies that are built from various pre-defined pieces: heads, torsos and legs that can combine in different ways.

 

Do you have to define the player sprites in one uninterrupted block? I tried to use if/then statements in the middle of the player definition, but it didn't seem to work. Could be that I am not doing it right...

 

Or is there another way to do this? Are there reserved variables (like the playfield variables) that contain the player data?

 

Thanks for the help.

Share this post


Link to post
Share on other sites

with bB I think you'd have to put the sprite data in RAM

where you could manipulate it and point the sprite

pointer(s) at the ram

(normaly the sprites are just blocks in ROM you can

choose diferent ones but you can't change them)

Share this post


Link to post
Share on other sites

with bB I think you'd have to put the sprite data in RAM

where you could manipulate it and point the sprite

pointer(s) at the ram

(normaly the sprites are just blocks in ROM you can

choose diferent ones but you can't change them)

 

I think I see what you're getting at. So instead of the normal player definition like:

 

if r = 0 then player0:
%00001000
I could set a variable like:
a = %00001000
b = etc...
c = etc...
And then define the player:
player0:
a
b
c
end
Will something like that work?

Share this post


Link to post
Share on other sites

 

 dim rand16 = z
 dim count = y

 rem the location of variable a is $00D6

 player0pointerhi = $00
 player0pointerlo = $D6 

 rem the sprite will be 10 bytes, 0..9
 rem here that's variables a..j
 rem the tenth location, location 9
 rem is the top

 player0height = 9

 player0x = 80
 player0y = 40

 rem just to show us where we are
 
 j = $FF

loop
 count = count - 1
 COLUP0 = $3A
 drawscreen

 if count then loop
 count = 30

 rem just scrolls some random
 rem stuff through the sprite to
 rem show something happening

 for temp1 = 0 to 8
 temp2 = temp1 + 1
 a[temp1] = a[temp2]
 next

 rem j is a[9] the top of the sprite
 j = rand

 goto loop
  • Like 1

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...