Jump to content
IGNORED

multicolour sprites example not working


nitrofurano

Recommended Posts

Well, I'm having problems getting it working also. Someone here will chime in, but I do see some things wrong with your code. I have never done multi colored sprites before, but here's what I see:

 

In the beginning you need

 

 set kernel_options player1colors

 

.. but when I enter that I get an error. I've never did multi player colors before like I said and someone else will figure it out since I'm at work right now.

 

Now second, instead of doing player1colors: and the numbers after that. The batari Basic Command Reference page says to use player1color:, not with an s on the end like you did.

 

I am not sure the code "if y = 10 then player1:" works, but someone better than me will answer that. I would be doing it like this:

 

  if y = 10 then gosub p1
 if y = 20 then gosub p2
 if y = 30 then gosub p3
 if y = 40 then gosub p4
 if y = 50 then gosub p5
 if y > 70 then y = 0

 

Although there is a way to shorten that. Each frame of your animation could be a subroutine. Within each of those subroutines (p1, p2, p3, p4, and p5) define your colors, player sprites, and then return to the main loop. You don't want your main loop so large.. as you have it now your main loop runs through every frame of animation each time it draws the screen. This will slow your program down and leave less time for the processor to do other things.

 

Thus, the way I am doing it it'll only run through the necessary code for that frame of animation. My gameloop would be shortened to this:

 

gameloop
 COLUBK=$02:COLUP1=$28
 y=y+1
 if y = 10 then gosub p1
 if y = 20 then gosub p2
 if y = 30 then gosub p3
 if y = 40 then gosub p4
 if y = 50 then gosub p5
 if y > 70 then y = 0 
 player1x = 50 : player1y = 50
 drawscreen
 goto gameloop

 

Hope I've helped some.

Edited by yuppicide
Link to comment
Share on other sites

This code doensn't work for sure - is for asking how multicolour sprites works on BatariBasic.

What i'm doing wrong on it?

Any help on fixing it is very welcome! =)

Thanks!

 

First, you forgot to set the bB kernel option to enable player1colors:

 

  set kernel_options player1colors

 

Then, you used the wrong command to define your player1colors: The command is singular, not plural:

 

   if y=10 then player1: 
	%00111100
	%00011000
	%00011100
	%00111100
	%00111100
	%00111100
	%00111000
	%00011000
	%00011000
	%00011100
	%00011100
	%00011000
end
 player1color:
	$4E
	$40
	$4E
	$4E
	$4E
	$4E
	$48
	$40
	$40
	$48
	$48
	$40
end

 

Fixed code is attached below.

 

Cheers,

Jarod.

5_AnimateASprite_02_fix.bas

Link to comment
Share on other sites

thanks a lot for all fixes (i'm learning a lot from them!), but anyway, is there any reason of NUSIZ0=$05 (wider sprite) is not working?

 

Yes. You are resizing the wrong sprite. "NUSIZ0" resizes and/or duplicates player0. "NUSIZ1" resizes and/or duplicates player1.

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