Set rotation speed for "motion" category
-
@tyller_ Well, right now on my tower defense game, I need help with measuring if there are no enemies on the screen, then a trigger will happen where everything stops firing. It’s set up to where the enemies will keep firing forever if they sense an enemy, but it’s bugged to where the game will only sense “no enemies” when the wave ends.
Nevermind I fixed it
-
@tyller_ Well, right now on my tower defense game, I need help with measuring if there are no enemies on the screen, then a trigger will happen where everything stops firing. It’s set up to where the enemies will keep firing forever if they sense an enemy, but it’s bugged to where the game will only sense “no enemies” when the wave ends.
Nevermind I fixed it
@011830-0a42ef84 you can add a counter for how many enemies have spawned that goes up when they spawn and down when they exit/get shot
-

There should be a rotation speed for the motion category when sprites point at objects that could potentially move. I think this would be an easy way for them to demonstrate top-down weight physics
@011830-0a42ef84
Can you explain a bit more what’s this new block would do? Is it a speed limit on how fast the object can rotate?
Do you think you can try to calculate how many degrees the object will rotate in total? If so, then you can calculate how long it should take based on the desired rotation speed, then you can use the following block to do the rotation:

-
@011830-0a42ef84
Can you explain a bit more what’s this new block would do? Is it a speed limit on how fast the object can rotate?
Do you think you can try to calculate how many degrees the object will rotate in total? If so, then you can calculate how long it should take based on the desired rotation speed, then you can use the following block to do the rotation:

@info-creaticode Yes but I need to target a continuously moving object.
-
@info-creaticode Yes but I need to target a continuously moving object.
@011830-0a42ef84 are you sure you want them to turn at a limited speed? you should just have them point towards the object at all times in the context of tower defense, turn speed isn’t really something to have (especially without projectile collision stuff)
-
@info-creaticode Yes but I need to target a continuously moving object.
@011830-0a42ef84
Can you share the project? Are you saying the target object is moving, and your sprite keeps rotating to face that target, but you don’t want your sprite to rotate too fast?
-
@011830-0a42ef84 are you sure you want them to turn at a limited speed? you should just have them point towards the object at all times in the context of tower defense, turn speed isn’t really something to have (especially without projectile collision stuff)
@tyller_ yes, but some units have heavier weapons like the mini gun, there-fore harder turning speed
-
@tyller_ yes, but some units have heavier weapons like the mini gun, there-fore harder turning speed
@011830-0a42ef84 the issue is you’ll need projectile/bullet speed first (or just detections on if a unit is pointing at an enemy so when it shoots it should actually damage an enemy)
-
@011830-0a42ef84
Can you share the project? Are you saying the target object is moving, and your sprite keeps rotating to face that target, but you don’t want your sprite to rotate too fast?
-
@011830-0a42ef84
Thanks. So, which sprite and which code blocks for that sprite are you trying to improve?
-
@011830-0a42ef84
Thanks. So, which sprite and which code blocks for that sprite are you trying to improve?
@info-creaticode On the minigun and launcher units, their turning automatically points to the fastest enemy. I would like there to be a turning time that is slower than just automatically pointing at them.
I would also like to know how for units to point at the first enemy, not just the fastest one.
-
@info-creaticode On the minigun and launcher units, their turning automatically points to the fastest enemy. I would like there to be a turning time that is slower than just automatically pointing at them.
I would also like to know how for units to point at the first enemy, not just the fastest one.
@011830-0a42ef84
Can you add some instructions in the project cover page to explain how to play the game? What are the keyboard or mouse controls?
-
@011830-0a42ef84
Can you add some instructions in the project cover page to explain how to play the game? What are the keyboard or mouse controls?
@info-creaticode The instructions are in the actual game, since that version is the test room, so it doesn’t include instructions
I moved the test room’s download to the actual one, you should see the instructions in that one.
https://play.creaticode.com/projects/672e66b5731b37123597e815
-
@info-creaticode The instructions are in the actual game, since that version is the test room, so it doesn’t include instructions
I moved the test room’s download to the actual one, you should see the instructions in that one.
https://play.creaticode.com/projects/672e66b5731b37123597e815
@011830-0a42ef84
This is a fun game.
So let’s solve one problem at a time. To limit the rotation speed, you can try to use a loop to repeatedly rotate the sprite a little bit towards the target’s direction.
Here is a demo project:
play.creaticode.com/projects/67351d4fef35162a42f8bc50
As you can see, in a forever loop, we take 3 steps:
- calculate angle difference between current direction and the desired direction
- normalize that difference to within -180 and 180
- rotate for up to the speed limit
This is what you will get as you move the mouse:

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login
