Trying to rotate an object while it moves with the mouse

0 favourites
  • 2 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • 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

  • Try Construct 3

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

    Try 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)