Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shadows

Status
Not open for further replies.

Barok

MIS
Dec 13, 2002
134
CA
on several games i've seen, the are around a sprite is a darker shade, in the shape of the sprite that's on the ground tile. does anyone know how to do this?
 
They probably drew the sprite pixil by pixil. They probably used something like this.

FOR x = 0 TO 10 'lets use round numbers
FOR y = 0 TO 10
IF sprite%(x,y) THEN
PSET (spx%+x,spy%+y),sprite%(x,y)
PSET (spx%+x+2,spy%+y+2), shadow%(POINT(spx%+x+2,spy%+y+2))
NEXT
NEXT

where they have a tabel made of the shadows for all of the colours
 
binarycoder: maybe it could work, but have you ever played quest for a king by sjzero? (demo) it utilizes shadows like this: it shows all the sprites. then below them is them upside down, except, say below the sprites is a grass tile with all these shades of green. the shadow is basically the same grass tile but with deeper shades of green, like a real shadow. (you don't really see real shadows all black or grey. it's just a deeper shade of those colours.) i'm guessing it's palette manipulation, and was just wondering if anyone knew about how it worked.
 
Try this in screen 13

a% = POINT (x%, y%)
IF a% > 31 AND a% < 183 THEN
PSET (x%, y%), a% + 72
ELSEIF a% < 32 AND a% > 14 THEN
PSET (x%, y%), a% + 1
ELSEIF a% > 182 THEN
PSET (x%, y%), 0
END IF

The colours 0 - 14 are oddballs you will have to assign shadows to them, but the ones above will be dead-on, this is using the default palettes for screen 13.
 
heh, i never really thought of that. I just remembered that the palette i'm working with is a gradient (e.g. say colour 20 is a very dark green, colour 40 would be a very bright green.) i'm trying to make a very flexible engine in pure qb, and thought that shadows would be a nice touch (wonder why i keep wanting to type real-time shadows?)
 
the only thing that would be a problem i guess would be the rotations. I mean, i don't want to waste space making dozens of upsidedown tiles, so i suppose that it would work better if i use sin and cos tables to rotate. then again, i'll probably use them for spell effects and particles anyways, and i guess if i make tables, the slowdown won't be bad, so i guess that'll work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top