is there any source to rotate a 32 x 32 sprite clockwise or
any..?
if we basically dim an array ;
dim sprite(31,31)
for y=0 to 31
for x=0 to 31
pset (ox+x,oy+y),sprite(x,y)
next
next
Can we rotate it ?
there is a way i think ;
if every pixeldata stores its' color and radious and angle.. then we can rotate it..
Where ox,oy is the center of object (not the upper left corner) one pixel needs 3 integers to be drawen..
But at 67 degrees with 1.447 radius would not give the original sprite on 320 x 200 x 8 screen....(for example)
Here is an example code ;
-------Example Code For Try Of Rotating 2D Objects----------
nop=120 'number of pixels
ox=159
oy=99
an=(22/7)/180
dim sprite(nop,3)
for t=1 to nop
randomize timer
sprite (t,1)=int(rnd*16)'radius
sprite (t,2)=int(rnd*359)'degrees
sprite (t,3)=int(rnd*100)'color
next
screen 13
gosub drawit
routinne:
a$=inkey$
if a$=chr$(0)+chr$(72) gosub turnleft
if a$=chr$(0)+chr$(77) gosub turnright
'not sure about scancodes
if a$=chr$(27) then end
goto routinne
turnleft:
for t=1 to nop
sprite (t,2)=sprite(t,2)+5
if sprite (t,2)>360 then sprite(t,2)=sprite(t,2)-360
next
gosub drawit
return
turnright:
for t=1 to nop
sprite (t,2)=sprite(t,2)-5
if sprite (t,2)<0 then sprite(t,2)=sprite(t,2)+360
next
gosub drawit
return
drawit:
cls
for t=1 to nop
pset (ox+(sprite(t,1)*cos(sprite(t,2)*an),oy-(sprite(t,1)*sin(sprite(t,2)*an)),sprite(t,3)
next
return
----------------------program ends here------------------
Try it and modify it i do not know how the results seems but i know that ;
Where ox+(sprite(t,1)*cos(sprite(t,2)*an)) = 123.22
it will draw it to 123.. By the way the original sprite wont be there or it will please try and help !!!!!!
[COLOR=ff6622] Shakespare says "To be or not to be" and we say "I/0" [/color]
any..?
if we basically dim an array ;
dim sprite(31,31)
for y=0 to 31
for x=0 to 31
pset (ox+x,oy+y),sprite(x,y)
next
next
Can we rotate it ?
there is a way i think ;
if every pixeldata stores its' color and radious and angle.. then we can rotate it..
Where ox,oy is the center of object (not the upper left corner) one pixel needs 3 integers to be drawen..
But at 67 degrees with 1.447 radius would not give the original sprite on 320 x 200 x 8 screen....(for example)
Here is an example code ;
-------Example Code For Try Of Rotating 2D Objects----------
nop=120 'number of pixels
ox=159
oy=99
an=(22/7)/180
dim sprite(nop,3)
for t=1 to nop
randomize timer
sprite (t,1)=int(rnd*16)'radius
sprite (t,2)=int(rnd*359)'degrees
sprite (t,3)=int(rnd*100)'color
next
screen 13
gosub drawit
routinne:
a$=inkey$
if a$=chr$(0)+chr$(72) gosub turnleft
if a$=chr$(0)+chr$(77) gosub turnright
'not sure about scancodes
if a$=chr$(27) then end
goto routinne
turnleft:
for t=1 to nop
sprite (t,2)=sprite(t,2)+5
if sprite (t,2)>360 then sprite(t,2)=sprite(t,2)-360
next
gosub drawit
return
turnright:
for t=1 to nop
sprite (t,2)=sprite(t,2)-5
if sprite (t,2)<0 then sprite(t,2)=sprite(t,2)+360
next
gosub drawit
return
drawit:
cls
for t=1 to nop
pset (ox+(sprite(t,1)*cos(sprite(t,2)*an),oy-(sprite(t,1)*sin(sprite(t,2)*an)),sprite(t,3)
next
return
----------------------program ends here------------------
Try it and modify it i do not know how the results seems but i know that ;
Where ox+(sprite(t,1)*cos(sprite(t,2)*an)) = 123.22
it will draw it to 123.. By the way the original sprite wont be there or it will please try and help !!!!!!
[COLOR=ff6622] Shakespare says "To be or not to be" and we say "I/0" [/color]