"Mouse is down" touch equivalent? [1.4]

wohoo

  • Posts: 128
Are there plans to add the touch equivalents of "mouse is down" and "mouse is down on self" to iStencyl?

It's a complete pain and often impossible to work around this. Even something as simple as detecting whether a finger slides off an actor is a hassle.

Pretty please?

« Last Edit: January 16, 2012, 01:29:52 am by Jon »

Dom818

  • *
  • Posts: 1296
On Stencylpedia, it said that the drag event simulates the mouse down. Although I came up with a way that uses a Boolean attribute and the when touched and when released to tell when the screen is touched. I can post a screenshot of this if you would like to see it.

wohoo

  • Posts: 128
Drag doesn't simulate mouse down from my experience. You have to actually drag something for it to take effect.

I've experimented with booleans too with some success, but haven't achieved exactly what I needed. Maybe I'm just chewing off too much. But yeah, do post that screenie, would love to see how you did it.

Here's a video of what I'm trying to achieve. Everything works wonderfully until I try to jump right after originally initiating movement with the left button. It's like the jump button thinks it's still going left when it's not. And it will only start moving right again once I drag the finger over, just touching won't do it.

http://www.youtube.com/watch?v=epXJ7pvUG8M

I've attached the behavior, too.

Jon

  • *
  • Posts: 17526
Yeah, the way that iOS reports events - drag isn't quite the same as mouse is down because you only get drag events if you move your finger. Right now, the equivalent to "mouse is down" would be a compound statement like this.

if(touched screen)
mouseIsDown = true;

if(released screen)
mouseIsDown = false;

Then the value of mouseIsDown is the same. So perhaps what we really want here is something like "isTouchingScreen"? There  might actually be an easier way to do this though - I wonder if you can use the # of touch points block and test if that's > 0 - won't that mean the same thing? If it does, I can make a dummy block that aliases to that.

Jon

  • *
  • Posts: 17526
Per the other topic, I think the best solution is to add this as a new state to the touch blocks, using the # of touch points method.

Jon

  • *
  • Posts: 17526
So here's what I'm going to do. Let me know if this makes sense.

I'll add a 4th state to track whether you are touching the screen/actor at all.

touch is [started, down, dragged, released]
[touched, is touching, is dragging, released] [ACTOR]
x/y of [initial touch, current touch, drag, release]

wohoo

  • Posts: 128
Nice, I think that'll make things easier.

Jon

  • *
  • Posts: 17526

psyche

  • *
  • Posts: 236
reviving this thread, the same "started, down, dragged, released" distinction would be nice in Stencyl 2.0 events "when the device/mouse is ... " as the "down" state is dearly missed :(