Rubbing with fingers gives off sound

Get help using Construct 2

Post » Tue Feb 21, 2017 8:56 am

I want to make a mechanism that sounds when rubbing a part of the screen with your finger

・No sound when I stop my finger
・Move your finger to make a sound

Image

I used [DragDrop is dragging].but this event is not good

・The sound keeps ringing without moving your finger.
・Sprite moves together


Please give me some advice.
B
5
S
1
Posts: 8
Reputation: 339

Post » Tue Feb 21, 2017 10:09 am

The problem is if you set something to play while you are touching the screen it will be triggered over and over as long as you touch the screen until you crash the sound card.

You need a more specific trigger and a way to stop that sound after it has played.

You could use a Y and X variable on the touch control for that trigger and I would check the acceleration of the drag. Keep the sounds short and add an auto stop so they don't overlap.

On Y > 100: Play sound
and X > 100
and Touchacceleration >50

On Y < 100: Stop all sound
Or X < 100
and Touchacceleration <50

Every 3 seconds: Stop all sound

Something like that.

You could also use blank sprites as trigger points on your screen that when the user slides across changes the sound being played.

Here is a CAPX for a continuous drag to change sounds using sprites:

https://www.dropbox.com/s/dr7susdzqyatyg4/Sound%20Touch%20Control.capx?dl=0
Last edited by lamar on Tue Feb 21, 2017 12:15 pm, edited 2 times in total.
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,830

Post » Tue Feb 21, 2017 10:24 am

lamar wrote:The problem is if you set something to play while you are touching the screen it will be triggered over and over as long as you touch the screen until you crash the sound card.


That is accurate.
So simply use the condition "Sound is not playing" (right click the condition/Invert) from the audio plugin in your "rubbing" event to play the sound in loop.

Event Rubbing
- Sound is NOT playing => Play sound

Event Stopped Rubbing
- Sound is playing => Stop sound
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,329
Reputation: 71,300

Post » Tue Feb 21, 2017 10:49 am

Easier way to do this is using the "Is touching" and "Is in touch" conditions.
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,246

Post » Tue Feb 21, 2017 10:52 am

MPPlantOfficial wrote:Easier way to do this is using the "Is touching" and "Is in touch" conditions.



I think he wants the user to drag continuously changing the sounds?
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,830

Post » Tue Feb 21, 2017 11:41 am

thank you! lamar,Kyatric,MPPlantOfficial

I think he wants the user to drag continuously changing the sounds?

yes. i want use drag.

I would like to try the following content, but I do not know what it is like.

[Touchacceleration] is [orientation & motion] in the event?

Sorry I do not understand well.....

On Y > 100: Play sound
and X > 100
and Touchacceleration >50

On Y < 100: Stop all sound
Or X < 100
and Touchacceleration <50

Every 3 seconds: Stop all sound
B
5
S
1
Posts: 8
Reputation: 339

Post » Tue Feb 21, 2017 12:07 pm

Here is a CAPX using 3 sprites as touch controls showing how to do it with continuous touch drag:

https://www.dropbox.com/s/dr7susdzqyatyg4/Sound%20Touch%20Control.capx?dl=0

Image

Image

I may have a use for that later!
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,830

Post » Tue Feb 21, 2017 12:56 pm

thank you lamar!!!!


I am deeply moved and I'm about to cry


I'll try!!!!!
B
5
S
1
Posts: 8
Reputation: 339

Post » Tue Feb 21, 2017 1:00 pm

gokusatu wrote:thank you lamar!!!!


I am deeply moved and I'm about to cry


I'll try!!!!!


LOL- well you don't need to go that far!

You are welcome and that is something I can probably use in a future game.
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,830


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests