How to make something rotate in place?
Hi everyone,
I imagine that this is pretty easy, but I just can't figure it out.
My game has falling objects using the move behaviour, and I want these objects to spin as they fall.
Any advice?
I imagine that this is pretty easy, but I just can't figure it out.
My game has falling objects using the move behaviour, and I want these objects to spin as they fall.
Any advice?
Best Answers
-
tatiang Posts: 11,949
Actually, if you change the velocity of the falling actor or change it's y position over time instead of using a Move behavior, you can just rotate it using the Rotate behavior. Scratch what I said before.New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
-
LiquidGameworks Anchorage, AKPosts: 956
@tatiang Does the image need to continually rotate? If so, you can interpolate rotation. Something like Rule: If self.rotation=0 then interpolate self.rotation to 360. Changing the duration changes the speed.
Answers
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Also I would recommend using an accelerate behavior so the objects pick up speed as they fall. It just adds a bit more realism.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
In the demo, I have two identical actors but one actor has your interpolate rule turned on and one actor has it turned off. They both start from the same position at the top of the scene but they end up in different positions at the bottom of the scene.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I've tried the rotate to position and rotate to angle behaviours and they don't seem to help much, (unless I'm not using them correctly). I don't want the objects to accelerate, it isn't a realistic game, it's more like Tetris. I'll try this, but I think I chose to use a Move behaviour for a specific reason. (I'm finishing a project that I haven't worked on in months). Oh is it that velocity has a "speed up" time? Because that wouldn't do unfortunately. I thought this would work, but like the rotate behaviour it makes it rotate to widely, I need it to "spin" in place as it falls. I do need it to constantly spin though.
Oh, and the Rotate behaviour now works as expected, so no Interpolate required. Unless it happens to be more efficient for some reason.
Having just played with the file, i found an easy fix. I don't know if its something you can't use due to gameplay conditions, but in your velocity/acc behaviors, change relative to "scene". When I did that, they stayed together on the same course.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User