How do I highlight a column while holding

Get help using Construct 2

Post » Wed May 06, 2015 1:28 pm

Hello,

My wish is to touch the screen and highlight the column it is currently selecting, when moving from left to right or vice versa.
There are no real columns, so I divided the screen in to columns of 50.

I thought: first i will create 8 columns (sprites) next to eachother and
Code: Select all
 when the cursos/finger touches one: make visible.

When not touching: invisible.
Problem: as long as the finger is pressed on the screen and slides on the x-axis, the other sprites stay visible.

So I tried adding another condition:
Code: Select all
when visible
when the cursos/finger touches one: it becomes visible.

Unfortunately not the desired the effect: everything I have selected stays visible untill I release the cursor/finger. :(
Last edited by mumu64 on Wed May 06, 2015 1:30 pm, edited 1 time in total.
My latest game is: Plants at www.rogerty.com
B
28
S
6
G
7
Posts: 683
Reputation: 5,686

Post » Wed May 06, 2015 1:30 pm

This should work:

Touch is touching column
> column set visible
else
> column set invisible
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 » Wed May 06, 2015 1:34 pm

Thanks for your reply.
I have tried, but all instances of the sprite I have touched (but currently not touching those instances), are still visible. (unless I release the mouse, or move to an area where these sprites not are)
If there was space between the sprites, this would have worked, but they are placed exactly next to eachother.
My latest game is: Plants at www.rogerty.com
B
28
S
6
G
7
Posts: 683
Reputation: 5,686

Post » Wed May 06, 2015 1:40 pm

I still think it should work, but well..
You could try this:

Create a global variable CollumnTouched

on touched collumn
> Collumntouched set value to column.uid
-- pick all collumn
> set invisible

touch is touching
system compare two values collumn.uid = Collumntouched
trigger once
> collumn set visible

touch on any touch end
> collumn set invisible
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 » Wed May 06, 2015 2:18 pm

Works now, thanks to your suggestion! Thanks!
My latest game is: Plants at www.rogerty.com
B
28
S
6
G
7
Posts: 683
Reputation: 5,686


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests