How do I Have Sprite face the Correct Way when Tapped

0 favourites
  • 6 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • Hey Folks

    Q) I'm creating a fish growth game for mobile and wanted to have the player's fish face the way the player has tapped with no rotation, only mirroring on the horizontal... as simple as it sounds I cant seem to get this to work I'm using the MoveTo Behaviour (third party plugin) which is great, however the fish by default doesn't mirror... so i'm stuck with an upside down fish that swims backwards. Perfect for some games - just not this one....

    Any help to achieve a normal fish swim behavior would be much appreciated! (also I'm new to the Construct community so hi :p)

    Thanks,

    Rob

  • Without looking at your capX im guessing that you would compare the tap position to the fish.X position and then mirror the Fish if required to based on the side of screen tapped on relative to the fish of course.

    eg:

    if fish is on left side(tap.x>fish.X) of tap position set mirrored

    and

    if fish is on right side(tap.x<fish.X) of tap position set not mirrored

    if you needed to you could spawn an invisible sprite at the tap position to help determine x position compared to the fish sprite x position.

    Does that make sense?

  • Hey - it defo makes sense - It's a system one of my courses uses, although it's not quite the perfect solution i'm looking for as it leaves half the screen with the fish turned the wrong way before overlapping.

    Thanks for the response though, I'll see if i can modify it!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A more immediate tap-player-mirrored solution could be:

    If Touch.X is -X than Player, then Player is mirrored - else not mirrored. I'm not sure how to input this into Construct 2.

    Can anyone help formulate that into Construct 2 speak?! One of the pitfalls of being a beginner

  • on any touch

    -- system compare 2 values : touch.x < player.x

    player set mirrored

    -- else

    player set not mirrored

    you'd have to do it on touch because when not touching touch.x =0 and touch.y = 0

  • Hey Little, thanks - it almost fully works! I'm having the issue you write about at the end, as soon as I release the tap or mouse click, the player fish reverts back to its non-mirrored state - here's what I've done:

    I'm using - On any Touch Start - as there isnt the option of using - On any Touch - as you have suggested (unless I'm doing something wrong... which is quite likely) any suggestions of how to maintain it's mirror?

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