LoginLogin

How do I set the point to rotate at on SPROT?

Root / FAQs / [.]

BlackDrag0n23Created:
Essentially, how do set the origin point of a sprite?

Use SPHOME
SPHOME ID,X,Y
For example, if you want to set it to the middle of a 16x16 sprite, you would use SPHOME ID,8,8 This also sets the point that is controlled by SPOFS, and the center for scaling.

Why thank you kind sir.

What if I wanted to make an animal rotate and move in that direction?

What if I wanted to make an animal rotate and move in that direction?
From the sound of it, I believe you would just need a simple loop for it:
ACLS
X=100
Y=50
SPSET 1,[animal sprite number]
SPHOME 1,8,8

WHILE 1
 VSYNC 1
 SPOFS 1,X,Y
 SPROT 1,360
 INC X,1
WEND
 
Unfortunately, I don’t know the syntax for SPROT very well, so you may have to change that slightly.

What if I wanted to make an animal rotate and move in that direction?
From the sound of it, I believe you would just need a simple loop for it:
ACLS
X=100
Y=50
SPSET 1,[animal sprite number]
SPHOME 1,8,8

WHILE 1
 VSYNC 1
 SPOFS 1,X,Y
 SPROT 1
 INC X,1
WEND
 
Unfortunately, I don’t know the syntax for SPROT very well, so you may have to change that slightly.
Thank you!

What if I wanted to make an animal rotate and move in that direction?
From the sound of it, I believe you would just need a simple loop for it:
ACLS
X=100
Y=50
SPSET 1,[animal sprite number]
SPHOME 1,8,8

WHILE 1
 VSYNC 1
 SPOFS 1,X,Y
 SPROT 1
 INC X,1
WEND
 
Unfortunately, I don’t know the syntax for SPROT very well, so you may have to change that slightly.
Thank you!
i'm having trouble. I don't quiet know what i'm doing wrong. the fish either goes in a random direction or not at a;;

snip the fish either goes in a random direction or not at a;;
Ever heard of the edit button? or Post checking?

snip the fish either goes in a random direction or not at a;;
Ever heard of the edit button? or Post checking?
Sorry didin't think that someone would be watching every single thing I post. XD

i'm having trouble. I don't quiet know what i'm doing wrong. the fish either goes in a random direction or not at a;;
Sorry, it may have been a problem with my first post of the code. I’ve fixed up my code to make the sprite continue rotating instead of just going to a single specified angle:
ACLS
X=100
Y=50
SPSET 1,[animal sprite number]
SPHOME 1,8,8

WHILE 1
 VSYNC 1
 SPOFS 1,X,Y
 SPROT 1,R
 INC X,1
 INC R,2
 IF R>360 THEN R=0
WEND
You can make the sprite spin faster by increasing the number that R is raised by in INC R,2. You can do you same for moving the sprite to the right by increasing the number that X is increased by.