? Moving a sprite with the circle pad (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Moving a sprite with the circle pad

  • #1 ✎ 2 KiloBlue Hello i am kiloblue On miiverse 4 some odd years ago i was STORM(creator of the Circle Pad Tester 3.1 and CLOCK programs) Back then i announced that i was releasing a mock up OS based on Windows XP called Directory OS XP Even though i was encouraged to do so and i was working on it, i hit a pretty solid problem. Im trying to create a mouse cursor system within the OS and i want to control the cursor with the Circle Pad but my problem is that i can only move it a little and thats it and it wont move anymore Can someone tell me what im missing or suggest anything? The code goes like this: CLS WHILE 1 VSYNC 1 STICK OUT X,Y LOCATE 1,2:PRINT X,Y SPSET 1,2 SPOFS 1,X,Y WEND Posted Edited by KiloBlue
  • #2 ✎ 13 hanzo STICK can yield a velocity of a cursor, not an absolute coordinate. Try modifying your code as follows. ACLS X=200:Y=120 SPSET 1,2 WHILE 1 VSYNC 1 STICK OUT SX,SY LOCATE 1,2:?FORMAT$("%03D,%03D",X,Y); X=X+SX*8:Y=Y-SY*8 IF X<0 THEN X=0 IF X>(400-16)THEN X=400-16 IF Y<0 THEN Y=0 IF Y>(240-16)THEN Y=240-16 SPOFS 1,X,Y WEND Posted Edited by hanzo
  • #3 ✎ 2 KiloBlue
    STICK can yield a velocity of a cursor, not an absolute coordinate. Try modifying your code as follows. ACLS X=200:Y=120 SPSET 1,2 WHILE 1 VSYNC 1 STICK OUT SX,SY LOCATE 1,2:?FORMAT$("%03D,%03D",X,Y); X=X+SX*8:Y=Y-SY*8 IF X<0 THEN X=0 IF X>(400-16)THEN X=400-16 IF Y<0 THEN Y=0 IF Y>(240-16)THEN Y=240-16 SPOFS 1,X,Y WEND
    Thank you so much! ive been on this for 3 years aaaaaaand now i feel dumb XD
    Posted