1. the W thing...
- Posted by Michael Packard <lgp at EXO.COM>
Apr 14, 1997
-
Last edited Apr 15, 1997
I just did a test with masking a 145x99 "W" image against a background in
320x200 just using sequences and display_image and got it bouncing all
over the screen at .105 per frame on my dx2-66. (its no fun to just have
it sit there, so I made it move) I'm using color 118 to mask. (my routine
is just as fast with any mask color value)
I don't understand all the confusion. What am I missing here?
Here's my draw code:
image is the W, background is the image on the screen, I kept it after I
loaded it and displayed it. sprite is a temporary image, {x,y} is where
it's drawn to. (you may need to offset x,y to match the position of your
background image on screen. My x and y are relative to the image.)
procedure drawit(atom x, atom y)
sprite=image
for i = 1 to length(image) do
for j = 1 to length(image[1]) do
a=image[i][j]
if a=118 then sprite[i][j]=background[y+i][x+j]
end if
end for
end for
display_image({x,y},sprite)
end procedure
It's even faster to dynamically scale the image down by an arbitrary
amount on the fly. That exercise is left to the reader.
The smaller the image, the faster this works.
Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria
Yes, it's in the book...=)