There is a Big mistake in my Code. But i dont find it! Can somebody help me?
For understanding: i want These Dialogs to appear when i Touch the House or the Shop. When i Touch the House i want the left Dialog and the Guy-Icon to appear, and when i Touch the Shop i want the right Dialog and the Shop-Icon to appear. When i Touch the already-touched-Building i want the Dialog to dissappear. Its that simple, but i Cant manage it -.-
First, the touched() function never gets called. The only function that gets called on each cycle is draw(), so if you want the touched function to get called, you have to include a call to it there.
Second, within the touched function, you’ve used the variable touch, but you haven’t passed anything to it.
To get around these issues, add this line to the bottom of your draw function.
touched(CurrentTouch)
Next, there’s nothing to call the dialog functions. If you touch one of the houses, it does change the variables, but doesn’t call the other functions. The code has to be told to call that function.
So, for example, go in after the line and add a call to draw the dialogs, like this:
HOUSEisItRight = true
drawdialogs()
In general, that’s what is missing: the calls that tell it to actually perform a function.
So does anyone else have the “flashing color” issue where when you strat a program the background will flash like a strobe and nothing will run? You have to hit reset a bunch in order for it to stop.
I remember having that and forget precisely what I did. I think a combination of rect(0,0,10,10) and background(0,0,0) at the start of draw() should fix. I think after 1.2.6 the rect won’t be needed.
@mark: wow, its better than before. But it does what i expected: it only shows my upgradewindows if touch.state == began, and when i put my Finger off or move it, the Color is changed to HOUSE-/STOREDIALOGf(alse)t(ouch)c(olor), wich means the Window is Not kept open for further instructions…
The moving issue can be changed by adding: or Touch.state == moving, but the Otter One? I tried to use “touch” instead of “currenttouch”, but then it says its not existing… Any idea?
See if this looks more like what you had in mind. I added a little variable to track dialog state. I also commented out your tint statements in the dialog. It looks like everything was getting tinted with alpha=0, making it invisible.
Omg thank you so much! I optimized your changes, and now, thats what i looked for! Thats what was thinkin of! Now, im going to work on further versions