less of a how, more of a why...

Get help using Construct 2

Post » Tue Jul 22, 2014 11:07 pm

When I click any of the upgrade buttons for the first time, nothing happens. But then it works just fine after that, can anyone tell my why the first click doesn't work? The events handling it are in the "upgrade menu" group.
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 51
Reputation: 502

Post » Tue Jul 22, 2014 11:25 pm

What version of C2 are you using?

Edit: seems to work ok in 175b. Also do you need the 'touch start/touch end' mechanism? I think you can just use 'Touch: On tap gesture on upgradeButton'
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Jul 22, 2014 11:40 pm

The code is being called, but I think only you can understand what's going on. You can use the Browser object to Log state, or use the debugger to inspect the data changes.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Tue Jul 22, 2014 11:45 pm

codah wrote:What version of C2 are you using?

Edit: seems to work ok in 175b. Also do you need the 'touch start/touch end' mechanism? I think you can just use 'Touch: On tap gesture on upgradeButton'


kinda new to using touch but I'll try that, the upgrades work on the first click for you? I'm on 173
B
6
S
1
Posts: 51
Reputation: 502

Post » Tue Jul 22, 2014 11:46 pm

blackhornet wrote:The code is being called, but I think only you can understand what's going on. You can use the Browser object to Log state, or use the debugger to inspect the data changes.


I know the code is being called that's why I had the test text there, but no variables get changed for me on the first click
B
6
S
1
Posts: 51
Reputation: 502

Post » Tue Jul 22, 2014 11:58 pm

trultz wrote:
codah wrote:What version of C2 are you using?

Edit: seems to work ok in 175b. Also do you need the 'touch start/touch end' mechanism? I think you can just use 'Touch: On tap gesture on upgradeButton'


kinda new to using touch but I'll try that, the upgrades work on the first click for you? I'm on 173


Yes you could simplify it by using tap gestures. However, your event is updating Variable1 twice in quick succession, and the second time it is always 0. I added some logging that shows that.
e.g.
<first tap of first button>
Variable1: 5
Variable1: 0
<first tap of second button>
Variable1: 1
Variable1: 0
<first tap of third button>
Variable1: 150
Variable1: 0

Check your logic :)

Edit: when I said it seems to 'work fine' I meant the first click is registering, but you knew that.
Edit 2: highly recommend using Browser plugin logging
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Jul 23, 2014 12:19 am

codah wrote:stuff



ah i didnt think about looking at the variable1, its really wierd sometimes it shows 100x the value, and i guess the problem was something that i had already run into, it doesnt like doing math with arrays
Image

that fixed it, and now that i know that was the problem could probly go back to using only 1 var
B
6
S
1
Posts: 51
Reputation: 502


Return to How do I....?

Who is online

Users browsing this forum: asdtricky, brunopalermo, ST314 and 26 guests