nitrofurano Posted December 1, 2008 Share Posted December 1, 2008 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! 5_AnimateASprite_02.bas Quote Link to comment Share on other sites More sharing options...
yuppicide Posted December 1, 2008 Share Posted December 1, 2008 (edited) 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 December 1, 2008 by yuppicide Quote Link to comment Share on other sites More sharing options...
jrok Posted December 1, 2008 Share Posted December 1, 2008 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 Quote Link to comment Share on other sites More sharing options...
nitrofurano Posted December 1, 2008 Author Share Posted December 1, 2008 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? Quote Link to comment Share on other sites More sharing options...
jrok Posted December 1, 2008 Share Posted December 1, 2008 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. Quote Link to comment Share on other sites More sharing options...
yuppicide Posted December 2, 2008 Share Posted December 2, 2008 I totally didn't even catch that one. Yes. You are resizing the wrong sprite. "NUSIZ0" resizes and/or duplicates player0. "NUSIZ1" resizes and/or duplicates player1. Quote Link to comment Share on other sites More sharing options...
nitrofurano Posted December 2, 2008 Author Share Posted December 2, 2008 yes, of course, NUSIZ0 on player1 - i'm so stupid... - sorry people! =) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.