2D Rotation
Author Message
2D Rotation

I'm trying to write a game in QuickBasic that uses 2D sprite rotation.
I found the generic x=radius*cos(angle) method, which worked fine on one
point, but when I tried to use it on each point of an array (ie. a 9x9
array, each element being a pixel) it would flip the sprite by the x and

Here's what I used:

screen 13

dim sprite(9,9)

[code to put stuff in sprite goes here]

do

for y = 1 to 9
for x = 1 to 9
dx = (x - 5) * cos(angle * PI / 180)
dy = (y - 5) * sin(angle * PI / 180)
pset (160 + dx, 100 + dy), sprite(x,y)
next x
next y

angle = angle + 1
if angle = 360 then angle = 0

loop while inkey\$ = ""

Can someone tell me what I'm doing wrong?

Thanks,
Alex

Sun, 30 Apr 2000 03:00:00 GMT
2D Rotation

Quote:

>I'm trying to write a game in QuickBasic that uses 2D sprite rotation.
>I found the generic x=radius*cos(angle) method, which worked fine on one
>point, but when I tried to use it on each point of an array (ie. a 9x9
>array, each element being a pixel) it would flip the sprite by the x and

I wrote an article on 2D graphics rotation in Basix Fanzine Issue 9. You can

http://www.users.globalnet.co.uk/~dewarr/basix.htm

Hope that helps,

Alex Warren,
Buckinghamshire, England

icq:   4043750

_______________________________________________________________________

WEBSITE:   http://www.users.globalnet.co.uk/~dewarr/

See the website for CyPet _ a virtual pet for Win95, MOD music files
for ST3 and IT, The BASIX Fanzine _ a magazine for programmers of
BASIC, QuickBASIC Programs, +++ more!
_______________________________________________________________________

Tue, 02 May 2000 03:00:00 GMT

 Page 1 of 1 [ 2 post ]

Relevant Pages