on key released -> touch version?

Get help using Construct 2

Post » Fri Jun 29, 2012 12:42 am

Hi guys,

Remember my game? http://gameoftrolls.net23.net/

well, now I'm porting the game to tablets and I need to add the "virtual gamepad". So far I've already created the arrows using the "touch" object and 3 sprites. the problem now is with the 2 powers (the FAP gun and the ULTRA Scream)

Currently I'm using two events:
On F pressed -> do the things I need..
On F released -> change again to normal mode

The problem is that with Touch object I don't have a "on touch with the object finishes" and that's causing me a headache

I'd like to create an event like
"On F icon is being touched" -> Simulates key F being pressed
"On F icon is not longer being touched" -> Simulates key F being released

Posts: 5
Reputation: 320

Post » Fri Jun 29, 2012 1:08 am

just invert the first test and use a variable to see if it was touch before !

If "icon is touch"
-> set var "IconWasTouched" to true
-> simulate F press

If "NOT" (invert the first test) "icon is touch" => YOU CAN USE A "ELSE" INSTEAD
(and) "IconWasTouched" is true

-> set var "IconWasTouched" to false (in fact tooglevalue)
-> simulate F release

(edit) If you have only 1 instance of the icon object you can create a instance variable in the icon object with the boolean type set to false by default.
naelian2012-06-29 01:29:54
Posts: 296
Reputation: 5,236

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests