? Rotate and move (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
💀

Rotate and move

  • #1 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself How do I make an animal rotate then move in the direction they're facing? Posted
  • #2 ✎ 1560 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website You can rotate sprites using SPROT. Posted
  • #3 ✎ 903 Y_ack Head Admin You can move towards a direction with DX = COS(ANGLE) DY = SIN(ANGLE) Posted
  • #4 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself
    You can move towards a direction with DX = COS(ANGLE) DY = SIN(ANGLE)
    Thank you!!!
    Posted
  • #5 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself
    You can move towards a direction with DX = COS(ANGLE) DY = SIN(ANGLE)
    Thank you!!!
    How would I turn that into when they rotate, They move that direction.
    Posted Edited by Z_E_R_O
  • #6 ✎ 405 SwanBot Halloween 2017 Contest Runner Up I placed 2nd in the SmileBASIC Source Halloween 2017 Contest! Programming Contest Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength First Year My account is over 1 year old Website Well it really depends on the type of sprite, top down ones sometimes dont love being held upside-down, but views from the top sometimes do love it. If I were you, I would bake them some nice cookies and tell them that they will get more if they love that direction. Posted
  • #7 ✎ 903 Y_ack Head Admin You can get the current sprite position with SPOFS ID OUT X,Y You can then update the position with SPOFS ID, X+DX, Y+DY Posted
  • #8 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself
    You can get the current sprite position with SPOFS ID OUT X,Y You can then update the position with SPOFS ID, X+DX, Y+DY
    I'll try that thank you
    Posted
  • #9 ✎ 282 spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength To get a sprite to rotate towards a specific random point you'll have to check a conditional and rotate the sprite a certain amount each loop iteration after choosing the final rotational degree. I'm not sure how to make it move in a direction using a degree. Rotational code: WHILE 1 'Game loop. You can put this in a DEF function (or just paste it) and use it elsewhere. IF #A AND BUTTON(3) THEN IF R<=0 THEN 'Start a new rotation after the last one completes. R=RND(360) ROTSPEED=RND(4) 'Optional, use if you want to rotate the sprite at a random speed each time. ENDIF IF R>0 THEN SPROT ID, R DEC R,ROTSPEED 'Spacing after punctuation may be a good idea but whatever ENDIF ENDIF VSYNC WEND When you press A, the sprite will rotate randomly. Be sure to set up the necessary sprite(s) and variables. Posted
  • #10 ✎ 109 Z_E_R_O Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Thank you Posted