Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Starting a fighting game
Oh thank you so much nathan.

Thanks for explaining the little part for me Glenn, it helped too.
·····································LINEAR INC·····································
Ø-----------------------------------------------------------------------O
From Problem to Solution - We take the shortest distance
Reply
Going backwards for a sec from the buffer. I'm having a bit of trouble with my masking code that nathan helped me with before. I never tested his program really but I did take the general concepts and I'm sure I applied them right. I tried a few various approaches here. I've uploaded my code and files (images and .til files). Including a photoshop pallate I made. Anyway here is the code. And you can download all of it and the images here.

RNDR3.BAS
Code:
DEFINT A-Z
SCREEN 13
CLS
DIM sprite(65, 66 + 66) AS INTEGER

OPEN "SPRITES.TIL" FOR BINARY AS #1

length = LOF(1) - 768

FOR sprt% = 0 TO (length / 66) - 1

   sprite%(0, sprt%) = 64
   sprite%(1, sprt%) = 8

   FOR byte% = 2 TO 33
      GET #1, (sprt% * 66) + 3 + ((byte% - 2) * 2), temp%
      'PRINT temp%
      sprite%(byte%, sprt%) = temp%
   NEXT
NEXT

'LOAD IN THE PALETTE

length = length + 1
DIM colorval AS LONG

FOR col = 245 TO 255
   GET #1, length + (col * 3), R%
   GET #1, length + (col * 3) + 1, G%
   GET #1, length + (col * 3) + 2, b%

   R% = R% AND 63
   G% = G% AND 63
   b% = b% AND 63

   colorval& = R% + (G% * 256) + (b% * 65536)

   PALETTE col, colorval&
NEXT

FOR a = 0 TO 63
PSET (a, 0), a
NEXT

' After the pallate has been loaded I'm loading in the mask.
' Both images have the same pallate composed of 10 colors. White being 10 and 0 being black I believe. Well no in the photoshop pallate it was I don't no how it's rearanged now.

'here I'm loading the mask
DIM mask(65, 66 + 66) AS INTEGER

OPEN "MASK2.TIL" FOR BINARY AS #2

length = LOF(2) - 768

FOR sprt% = 0 TO (length / 66) - 1

   mask%(0, sprt%) = 64
   mask%(1, sprt%) = 8

   FOR byte% = 2 TO 33
      GET #2, (sprt% * 66) + 3 + ((byte% - 2) * 2), temp%
      'PRINT temp%
      mask%(byte%, sprt%) = temp%
   NEXT
NEXT
PAINT (100, 100), 1
'*********** Draws the sprite
FOR z = 0 TO 1

FOR drawx = 0 TO 21
     IF z = 0 THEN
          a = 0
          b = 2
     ELSE
          a = 3
          b = 5
     END IF

     FOR drawy = a TO b
          PUT (drawx * 8, drawy * 8), sprite(0, spritenum), PSET
          spritenum = spritenum + 1
     NEXT drawy
NEXT drawx
NEXT z
'************ Draws the mask over it
FOR z = 0 TO 1

FOR drawx = 0 TO 21
     IF z = 0 THEN
          a = 0 + 6
          b = 2 + 6
     ELSE
          a = 3 + 6
          b = 5 + 6
     END IF

     FOR drawy = a TO b
          PUT (drawx * 8, drawy * 8), mask(0, masknum), XOR
          masknum = masknum + 1
     NEXT drawy
NEXT drawx
NEXT z

'*********** Just for show like nathan did in his example
spritenum = 0
FOR z = 0 TO 1

FOR drawx = 0 TO 21
     IF z = 0 THEN
          a = 0 + 12
          b = 2 + 12
     ELSE
          a = 3 + 12
          b = 5 + 12
     END IF

     FOR drawy = a TO b
          PUT (drawx * 8, drawy * 8), sprite(0, spritenum), PSET
          spritenum = spritenum + 1
     NEXT drawy
NEXT drawx
NEXT z

'************
masknum = 0
FOR z = 0 TO 1

FOR drawx = 0 TO 21
     IF z = 0 THEN
          a = 0
          b = 2
     ELSE
          a = 3
          b = 5
     END IF

     FOR drawy = a TO b
          PUT (drawx * 8, drawy * 8), mask(0, masknum), XOR
          masknum = masknum + 1
     NEXT drawy
NEXT drawx
NEXT z

DO: LOOP UNTIL INKEY$ <> ""

CLOSE #1, #2
·····································LINEAR INC·····································
Ø-----------------------------------------------------------------------O
From Problem to Solution - We take the shortest distance
Reply
Please help me figure out why I'm not getting transparency.
·····································LINEAR INC·····································
Ø-----------------------------------------------------------------------O
From Problem to Solution - We take the shortest distance
Reply
Well, you don't get transparency 'cause you are not following the steps.

1.- You need your sprites to have colour #0 for transparent zones.
2.- You need your masks to have colour #255 (&HFF) for transparent zones, and colour #0 for solid zones.
3.- You put your MASK with AND, then you put your Sprite with XOR.

I have no clue what are you doing in your code:

:???:

You just need:

Code:
PUT(x%,y%), mask%(0, m%), AND
PUT(x%,y%), sprite%(0, m%), XOR

Remember that the mask is used to create a "black hole" in the background ('cause the XOR blitting only works in black backgroundos) with the shape of your sprite, and then you're ready to blit your sprite.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
Umm that's great and all I get most of it but umm a slight problem. How do I get my background to be #255, and my sprite bg to be #0. I don't no how to reoganize the pallate like that. Or create colors that would be in those spots of the pallate. If you could help me by converting them somehow that would be great but I'm a little lost here. Unless ofcoarse you simple mean I should just make the sprite have black bg and the mask have white bg for transparency then I don't have a problem otherwise I'm so fricking confused.

PS: I figured out the buffer. THANKS ALLOT Everyone. I even got most of the segment offset stuff. Some of it was very clever. For example in nathan's example how he set a pixel in the middle of the screen and new the mem of it and used it to find the location in memory was pretty intresting. Other parts made good sense. Some things are still very sketchy.
·····································LINEAR INC·····································
Ø-----------------------------------------------------------------------O
From Problem to Solution - We take the shortest distance
Reply
And I don't know why some of my posts got deleted.

my post was....

Pset???

Put(x,Y),spr,and
Put(x,y),sprmask,or

?????????
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
Kofman, I told this to you before: You better get a good, old GFX designer for indexed modes (PSP3, Deluxe Paint or Neopaint for example) with good palette support if you're gonna use a paletted mode (such as SCREEN 13's mode 13h). I can give you link to any of those three programs, if you like.

I know that switching is a bummer, but you'll need _complete_ control over colour indexes if you're gonna make games.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
*sigh, can any of these programs take .pcx and load them in so I don't have to redraw them. would never be able to redraw them.
·····································LINEAR INC·····································
Ø-----------------------------------------------------------------------O
From Problem to Solution - We take the shortest distance
Reply
.
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply
Quote:*sigh, can any of these programs take .pcx and load them in so I don't have to redraw them. would never be able to redraw them.

*blink* *blink*

Okay, fire up DeluxePaint and save an empty file. Go into PSP and extract the palette. Image -> Mode -> colour table. Save it. Now load up your other files. Break 'em into 320x200 chunks, and convert them to indexed colour with photoshop, but tell it you want it to use your palette, not whatever it happens to come up with.

Do your future art in DP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)