How to test if button is pressed/released


#1

So, for my Hoptale engine, I'm trying to figure out how to test if a button is pressed(set a value to 1) Then when it is released(set the value to 0). Thanks.


#2

This post was flagged by the community and is temporarily hidden.


#3

@Intellection74 It doesnt seem to work. I have This: When is pressed, set value to one. Then I have when 7 = 7, Check if value is 1- Dont do anything(cuz i dont need it to), else set value to 0.
However, this does not work and leaves the value at 1. Am i doing something wrong?

Hopefully this clears a bit up: When button is pressed, set value to 1. When button isn't pressed or it is released, set value to 0


#4

This post was flagged by the community and is temporarily hidden.


#5

This post was flagged by the community and is temporarily hidden.


#6

@Intellection74 But thats what I have..
When pressed
Set value to 1

When 7=7
Check if Value = 1


Else
Set value to 0


#7

This post was flagged by the community and is temporarily hidden.


#8

No. That would cause it to update every frame from 1 to 0 to 1
@Intellection74 Im on to something right now though hold on


#9

This post was flagged by the community and is temporarily hidden.


#11

I figured it out @Intellection74 and @Stradyvarious.
When button is pressed, set value to 1
when 7=7
Check if value =0
nothing
else
set value to 0


#12

Sorry. i get confused with this and Tynker that i use to code.
The two codes get merged together in my brain.


#13

This post was flagged by the community and is temporarily hidden.


#14

Let me finish up, and see how everything works when I have everything setup... Something is worrying me.


#15

This post was flagged by the community and is temporarily hidden.


#16

@Intellection74 ah HA. I knew something would be wrong... Time to time, the value will be in a state of flickering between 0 and 1, its random. I think this way because: If the value is at one, then set it to zero, b/c of check if else Value = 0. So yeah. more problems. Maybe someone else has another idea?


#17

i'm working on it now. i had this same problem 4 months ago and found a solution. trying to rember how i did it


#18

Remember, it can't be the whole ipad, just a single character. The odds of this Flicker state is about 3/4 chance


#19

This post was flagged by the community and is temporarily hidden.


#20

@Intellection74 What do you mean? I'm trying something else with a When char is pressed


#21

This post was flagged by the community and is temporarily hidden.