How do I set sprite position right?

  • Hi. Sorry for my English.

    I have one sprite "Player", and want to move this sprite only horizontal with mouse (arkanoid style).

    System - Every tick - Player - Set X to Mouse.X

    Its work, but in preview "Player" allways start in left coner of the layout. But I want set Player potition to the middle on start of layout. What I can do?

  • You can set

    - X to LayoutWidth/2

    - Y to LayoutHeight/2

    BUT with everytick, it will set your player X as Mouse.X.

    You will need a variable to trigger it.

    Like:

    State 0:

    - X to LayoutWidth/2

    - Y to LayoutHeight/2

    On Mouse Click: set State to 1

    State 1:

    - X to Mouse.X

  • Thank you. I tried this. But now "Player" sprite on right side of layout.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Now I set paddle vertical, and add this: clamp(Mouse.Y, WallTop.Y+Player.Height/2, WallDown.Y-Player.Height/2)

    I can control paddle (player) vertical, but on start of layout, paddle appears on up side of layout. What else can I do to start the game with paddle centre of Y coordinate?

    And another question. When I set mouse to control player (up and down), keyboard control ( 8 direction) stop working. How I do to work mouse movement a keyboard at the same time?

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