Sprites 'cutten', wie?

Previous topic - Next topic

Tenorm

Hi,

wie kann ich nur einen bestimmten Bereich eines Sprites zeichnen, z.B. von einem 128x128 Pixel Sprite nur ein Quadrat von 32x32, dessen Position aber variirt. Soll ne Minikarte werden ;)

Danke schon mal

Tenorm

Moru

Look in the manual for LOADANIM, that might be what you want. Unless you want to show a 32x32 piece of a big picture? In that case look for VIEWPORT instead :-)

Tenorm

viewport sounds intressting, thank you!

Hab ich im Handbuch ?bersehen, sry!

Schranz0r

Jo, Viewport und dann "scrollen" das Ding :)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Tenorm

Kann man eigendlich auch irgendwie nen Kreis machen => runde Karte...

Moru

First way:
Set up the VIEWPORT, draw the map, then draw another sprite over that has a round hole in the middle that is transparent, then you have a circle-map.

Second way
do a CREATESCREEN, draw your map on this and mask out the edges so you get a round disc like above and then you draw this screen like a sprite on your gamescreen.

Just ideas how to do it, no direct solution, sorry :-)

Kitty Hello

I used the 2nd way in the PuzzleBox remake, when I fade in/out the screen.
But instead of a sprite, I used a POLYVECTOR function that clears the screen:

Code (glbasic) Select



WHILE TRUE
MOUSESTATE mx, my, b1, b2


MarioOut(mx / 800)
SHOWSCREEN



WEND


// -------------------------------- //
// Mario-Stlye fadeout
// -------------------------------- //
FUNCTION MarioOut: delta
LOCAL i, r, st, p, x, y, c
LOCAL windowx%, windowy%
GETSCREENSIZE windowx, windowy
i = windowx/2
x = windowx/2
y = windowy/2
x = SQR(x*x + y*y)

c=RGB(255,255,255)
st=6
r = MAX(0, delta * windowx - 16)

// top right
STARTPOLY -1
POLYVECTOR windowx,0,0,0,c
POLYVECTOR windowx/2,0, 0,0,c
FOR i=0 TO 90 STEP st
POLYVECTOR windowx/2+r*SIN(i),windowy/2-r*COS(i),0,0,c
NEXT
POLYVECTOR windowx,windowy/2,0,0,c
ENDPOLY

// bottom right
STARTPOLY -1
POLYVECTOR windowx,windowy,0,0,c
POLYVECTOR windowx,windowy/2, 0,0,c
FOR i=90 TO 180 STEP st
POLYVECTOR windowx/2+r*SIN(i),windowy/2-r*COS(i),0,0,c
NEXT
POLYVECTOR windowx/2,windowy,0,0,c
ENDPOLY

// bottom left
STARTPOLY -1
POLYVECTOR 0,windowy,0,0,c
POLYVECTOR windowx/2,windowy, 0,0,c
FOR i=180 TO 270 STEP st
POLYVECTOR windowx/2+r*SIN(i),windowy/2-r*COS(i),0,0,c
NEXT
POLYVECTOR 0,windowy/2,0,0,c
ENDPOLY

// top left
STARTPOLY -1
POLYVECTOR 0,0,0,0,c
POLYVECTOR 0,windowy/2+1, 0,0,c
FOR i=270 TO 360 STEP st
POLYVECTOR windowx/2+r*SIN(i)+1,windowy/2-r*COS(i),0,0,c
NEXT
POLYVECTOR windowx/2,0,0,0,c
ENDPOLY
ENDFUNCTION


Tenorm