How do I Have Sprite face the Correct Way when Tapped

Get help using Construct 2

Post » Thu Nov 05, 2015 3:06 am

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
B
3
Posts: 5
Reputation: 187

Post » Thu Nov 05, 2015 3:52 am

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?
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Post » Thu Nov 05, 2015 6:36 am

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!
B
3
Posts: 5
Reputation: 187

Post » Thu Nov 05, 2015 11:02 pm

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 :(
B
3
Posts: 5
Reputation: 187

Post » Thu Nov 05, 2015 11:06 pm

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
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Nov 06, 2015 12:24 am

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:

Image

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?
B
3
Posts: 5
Reputation: 187


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, tarek2 and 26 guests