Page 1 of 1

Posted: Mon Jan 06, 2003 5:00 pm
by BackupUser
Restored from previous forum. Originally posted by Kendrel.

Iam converting some old stuff from me to Purebasic, and have a little problem now... it is a painter like game where you have to make the picture visible... so far everything works ok, but i guess iam doing it in a wrong way... take a look (snippet)

StartDrawing(SpriteOutput(2))
For i=0 To 20
For j=0 To 20
farben(i,j)=Point((Player1x-25)+i,(Player1y-26)+j)
Next j
Next i
StopDrawing()
StartDrawing(SpriteOutput(1))
For i=0 To 20
For j=0 To 20
If Point(player1x+i,player1y+j) = 0
Plot(Player1x+i,Player1y+j,farben(i,j)) ; Draw another point (Red)
starttimer+1
EndIf
Next j
Next i
DisplaySprite(#Player,Player1x,Player1y)
StopDrawing()


as you can see i retrieve the pixel information from the hidden picture via the Point command, and draw them later with the Plot command. This works i the size is only 20*20 on my 700 Duron, but well... there should be an other way to do this.

It would be nice to have a CopySpriteRect command for example where you could just clip a part of the sprite and copy it onto another (only overdraw)...

i hope you know what i mean and have some tips :)

so long,

kendrel

Posted: Mon Jan 06, 2003 5:49 pm
by BackupUser
Restored from previous forum. Originally posted by MrVainSCL.

HI Kendrel...
i am not sure if i understand you correctly... You want to code a game where you have challenge something to get part to part of the hidden picture and this picture is splitted in x/y 20*20 big tiles, right? If so, you can just load/catch the full image as sprite and Display it at any postition (0,20,40,60,80,...) you wish... Before drawing the sprite, you have just only to use ClipSprite(...) command to set the area you want to clip... Maybe this will help you..


PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX9.0, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten

Posted: Mon Jan 06, 2003 5:56 pm
by BackupUser
Restored from previous forum. Originally posted by Kendrel.

errm... no :)

i want to copy an area from a sprite1 onto sprite2... without losing sprite2... so i want to overdraw it...

Posted: Mon Jan 06, 2003 6:34 pm
by BackupUser
Restored from previous forum. Originally posted by Kendrel.

Since you got BB, take a look at this... i wanted to do this in PB :)

SetBuffer BackBuffer()
While Not KeyHit(1)
Cls
SetBuffer BackBuffer()
DrawImage Backdropbw,0,0
DrawImage Backin,25,26
DrawImage Playfield,25,26
DrawImage Player,PlayerX+25,PlayerY+26
Flip
Gosub Moveplayer
SetBuffer ImageBuffer(Playfield)
DrawImageRect Background,PlayerX,PlayerY,PlayerX,PlayerY,20,20
SetBuffer BackBuffer()

Cls
Wend

Posted: Mon Jan 06, 2003 7:47 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

USeBuffer(#Sprite) should do the trick

Fred - AlphaSND

Posted: Mon Jan 06, 2003 9:00 pm
by BackupUser
Restored from previous forum. Originally posted by Kendrel.

Thx alot... i missed that one...

and that is why i love this place and PB... :)