Image will not properly draw
Author |
Message |
aspire
|
Posted: Fri Nov 30, 2007 11:16 am Post subject: Image will not properly draw |
|
|
Hello. I am in need of some help.
I am trying to draw an image moving around the screen with a background. Now when I do the picMerge, it seems to merge some of the inner image too.
Any ideas ? Suggestions ?
Here are the images:
code: |
php.thefixation.net/airplane2.bmp
php.thefixation.net/air.bmp
php.thefixation.net/mountain_background.bmp
|
Turing: |
% The Moving Bird
var logoPicID, bgPicID : int
% Picture ID's and background
var logoWidth, logoHeight : int
% Width and Height
var x, y : int := 0
% Lower left corner of bird
var dx, dy : int := 3
% Load the logo from file and get its height and width
logoPicID := Pic.FileNew ("airplane2.bmp")
logoWidth := Pic.Width (logoPicID )
logoHeight := Pic.Height (logoPicID )
%Load the background from the file and draw it in the dinow
Pic.ScreenLoad ("mountain_background.bmp", 0, 0, picCopy)
loop
% Take the picture of the background
bgPicID := Pic.New (x, y, x + logoWidth, y + logoHeight )
% Draw the bird
Pic.Draw (logoPicID, x, y, picMerge)
delay(50)
% Draw the background over the bird
Pic.Draw (bgPicID, x, y, picCopy)
% Free up the memory used by the background picture
Pic.Free (bgPicID )
%Check if the logo bounced of the left or right edges of the window
if x + dx < 0 or x + dx + logoWidth > maxx then
dx := -dx
end if
%Check if the logo bounced off the top or bottom edges
if y + dy < 0 or y + dy + logoHeight > maxy then
dy := -dy
end if
% Change the location of the Bird
x := x + dx
y := y + dy
end loop
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Zampano
|
Posted: Fri Nov 30, 2007 11:20 am Post subject: Re: Image will not properly draw |
|
|
I had this problem a while ago. The problem is that a part of the image is the same colour as the background. Unfortunately, Turing has no method of removeing the background and not the inside.
The best method to solve this as I know of is to change the background to a colour that is not used at all in the actual figure, and use Pic.SetTransparentColour (the colour you changed the background to). Then you will remove the background and not the character. |
|
|
|
|
|
aspire
|
Posted: Fri Nov 30, 2007 1:09 pm Post subject: RE:Image will not properly draw |
|
|
Ok. Thanks for the answer, I will try it out. |
|
|
|
|
|
|
|