0 Favourites

Trying to rotate an object while it moves with the mouse

  • 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

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)