help with colored sprites in basic wanted (Development MSX Fora)MSX Resource Center            
            
English Nederlands Espa�ol Portugu�s Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 55 gasten en 4 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - help with colored sprites in basic wanted

Ga naar pagina ( 1 | 2 Volgende pagina )
Schrijver

help with colored sprites in basic wanted

norakomi
msx professional
Berichten: 861
Geplaatst: 30 Januari 2005, 19:23   
HI !!!

I´m making games in basic (don´t laugh, I love xBasic, it really speeds up my
games).
but, I have some problems with colored sprites.
There is a site which gives help with making colored sprites
http://www.geocities.com/andrear1979/msx/msxsprites/ver2/MsxSprites8x8.html
to make (in this case) 8x8 colored sprites.
this works properly, however if I make a sprite with 5 colors,
then this editor creates 5 sprites (each with one color) and I put them on top
of each other.
When i make this sprite move, it doesn´t really move as 1 sprite, but as
5 sprites (hampering).
Is there a way to make a sprite with more colors, and really do this with
1 sprite???

(i figured out that i can color each row of a sprite with:
color sprite$(1)= etc...
but this doesn´t give me enough freedom to color each pixel of a sprite)

thank you !!

bart van velzen qz3@811m.com
wolf_
online

msx legend
Berichten: 4777
Geplaatst: 30 Januari 2005, 19:30   
simple answer: you can't!

On msx2 you only have a color per line.. you want more colors? use more sprites!

Fortunately there's a trick using OR or XOR .. dunno.. one of them, which means that using 2 sprites layered you can have 3 colors per line! (see Usas for example..) It's fairly logical: if each sprite has a pattern made out of zeros and ones, then with 2 sprites there're 4 combinations.. (0 0, 0 1, 1 0, 1 1) .. one of them is transparent.. so: 3 colors at your disposal..
You're limited to which colors you can use per line .. based on the color(lines) of each sprite..

But how to do that in basic.. dunno.. ^_^
pitpan
msx master
Berichten: 1389
Geplaatst: 30 Januari 2005, 19:34   
For MSX1 there is no other option but to overlap different sprites. As you already discovered, then it is very difficult to move them in BASIC without experiencing some problems. Assembler is the solution there. By the way, you cannot use 5 sprites in the same horizontal line on a MSX1 machine. 4 is the limit.

For MSX2 and higher, you can use coloured sprites, but only one different color in every pixel row, what is a huge limitation. Again, of course, you can overlap some of them (usually 2 is enough, because you can use some "boolean logic" tricks on the colors). The other solution is to use "software" sprites, COPYing images and masking the background.

No solutions, just facts. Sorry about that!

[D-Tail]

msx guru
Berichten: 3019
Geplaatst: 30 Januari 2005, 19:55   
XBASIC is more than fast enough to move 5 sprites simultaneously (that is, one movement per 1/50 or 1/60 second). So it will work

Point is, you probably need more sprites for other objects, and the more sprites you use, the longer it will take for your program to put them on screen... Good luck, anyways

I also (tried to) make games in xBASIC. While you're at it, check NestorBASIC @ www.konamiman.com. It's xBASIC PLUS some very cool disk routines, music replay routines, etc
norakomi
msx professional
Berichten: 861
Geplaatst: 30 Januari 2005, 20:22   
WOW,
first I´d like to thank you all for your amazingly fast replys !!
Ultra cool
However your replys made me a bit sad.
I hereby learn that in basic it is not possible to color each pixel of a
sprite.
If I use 2 sprites on top of each other the movement will become ugly
(not fluently).
So it seems that I have to combine assembly with basic.
is there a way to make a multi coloured sprite in assembly language and put this sprite in screen in basic?
and if so, can someone give me a small example of a coloured sprite (this can be 2 pixels) which is put on screen in assembly language?
I knowledge of assembly language is limited (a little wbass), but I want to make my games (mostly) in basic.

hmmmm....
(ps i just tried a little nestor basic. thanx for the tip)

thank you again !!

bart van velzen qz3@811m.com
wolf_
online

msx legend
Berichten: 4777
Geplaatst: 30 Januari 2005, 20:26   
* multi-color sprites are not possible on an msx 1 ... doesn't matter whether it's basic or asm ..

* the only thing you can do on an msx2 (or higher) is a color per line (possible in basic)

* only way to have semi-multicolorsprites = adding sprites together, optionally using that or/xor trick. That's possible in basic, be it a bit wacky.. and I dunno about the or/xor part for basic
snout

msx legend
Berichten: 4991
Geplaatst: 30 Januari 2005, 20:33   
I think software sprites are the way to go for you in this situation. Once you get the hang of it, you'll love this solution, provided you can get enough speed from Xbasic to perform all copies & checks you'd like to perform
wolf_
online

msx legend
Berichten: 4777
Geplaatst: 30 Januari 2005, 20:34   
ps.. your solution is a Graphics9000 cartridge

--> 16 full-color 16x16 sprites on a row ^_^


{edit:} my informants of the secret service informed me that using a sprite-line as OR, you have to add 64 to the color for that line .., keep the spritenumbers sequental tho..
[D-Tail]

msx guru
Berichten: 3019
Geplaatst: 30 Januari 2005, 21:04   
As said, multicoloured singular sprites aren't simply possible on MSX1/2/2+/turboR.

You'll need a GFX9000 for that, indeed. What you can do, is give each row (16 rows) a color. But it's not pixel oriented, too bad. And something to cheer you up: you can pretty much do the same with sprites in BASIC/xBASIC/NBASIC, compared to ASM ...
norakomi
msx professional
Berichten: 861
Geplaatst: 31 Januari 2005, 12:28   
is it a good idea to use software sprites in combination with a existing sprite so you can use the on sprite gosub statement in basic to determine collision??

I figured out how to colour each row of my sprites (in 8x8 and 16x16), but this unfortunately does not fullfill my wishes, neither does combining 2 of those sprites (because as said before: the movement of those sprites 2gether doesn´t look nice)

So, I´m going to practice software sprites now, however I have been thinkin about learning assembly.

I added a new post on development about problems I encountered with the use of assembler W-bass. I´d be thankfull for all the help !!

Bart !


Sonic_aka_T

msx guru
Berichten: 2269
Geplaatst: 31 Januari 2005, 16:51   
With some clever planning of the color palette and a proper sprite converter you should be able to convert those 5 sprites into 3 sprites using the OR feature though... If you're going to use software sprites though, I suggest you turn off hardware sprites completely. This way your COPY commands are executed a great deal faster. I don't know all the turbo-like-BASIC-versions out there, but most of them should normally support highspeed copies when possible. This means that if you keep your x coordinates and size an even number, erasing the sprite should go pretty fast. So if the amount of sprites is not too high, this should work pretty well...
[D-Tail]

msx guru
Berichten: 3019
Geplaatst: 31 Januari 2005, 20:24   
And euhm... use VPOKE, and not PUTSPRITE, pretty please
norakomi
msx professional
Berichten: 861
Geplaatst: 02 Februari 2005, 00:42   
vpoke~???
(as you see I am a newby.....
nevertheless.... eager to learn !!
in what way can I use vpoke to replace put sprite???

thank you !
[D-Tail]

msx guru
Berichten: 3019
Geplaatst: 02 Februari 2005, 08:45   
Hmmm... Maybe the MSX Assembly Page is something good for you . It contains vast information about the VDPs (Video Display Processor) the different MSX models utilise. What you're looking for, to display sprites using VPOKE instructions (VPOKE == Write a (1) byte to video memory), is some entities called 'Sprite Attribute Table', 'Sprite Generator Table' and 'Sprite Colour Table'. See if you can find it , for I don't have those tables in the head at the moment, and my YAMAHA v9938/v9958/v9990 manuals are somewhere else at the moment... Just try and look for it
[D-Tail]

msx guru
Berichten: 3019
Geplaatst: 06 Februari 2005, 03:28   
Norakomi: Did you succeed your quest?
 
Ga naar pagina ( 1 | 2 Volgende pagina )
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.