Trying to rotate an object while it moves with the mouse

Get help using Construct 3!

Post » Sun Jun 11, 2017 7:55 pm

Hello, I'm trying to make a tycoon game. I already have a way so the user can place buildings. However, while the building is "Floating" (Is following the mouse), the user should be able to rotate the building while pressing R. But what happens is that the building doesn't rotate when the variable IsFloating is true, which is the one that checks that the player hasn't place the building. Here's the .c3p https://www.expirebox.com/download/d369 ... b9c9c.html
B
10
S
1
Posts: 1
Reputation: 456

Post » Sun Jun 25, 2017 9:28 am

Oops! File Expired or Deleted..

This file has been deleted for one of these reasons:
It has passing 2 Days of storage
It has been reported or deleted by a user
It has been deleted by staff for violation of terms

however, i do like that approach, so as a capx isnt indefinitely floating online. smart.

i believe what you're looking for, is (something along the lines of):

On Click - set variable "Mouse1" to Mouse.XY
-Is Click Down - Set Variable "Mouse2" To Mouse.XY
- Set Sprite Rotation to "Mouse2" - "Mouse1"
-On Click Released - Set Variable "Mouse2" to Mouse.XY
- Set Sprite Rotation to "Mouse2" - "Mouse1"

this would set a variable to the mouse start position, and a second to the current/end position, and subtract the start from the finish, i.e. if start is 208, and end is 220, 220-208=12, so it'd set the rotation to 12. its not gonna be something you can copy and paste, youll have to fine tune it. id suggest making the -is click down -on released into subevents to keep from rotating on every click.
B
22
S
12
G
1
Posts: 108
Reputation: 2,774


Return to How do I...?

Who is online

Users browsing this forum: No registered users and 2 guests