Interpret multiple key presses

I am working on a top secret new project. using defold and a makey makey.

This project involves something which the computer will interpret as many keys being held at once. But, at least with my macbook air keyboard, I can’t get defold to interpret more than two keys being held at once. Is this a defold thing? Or a mac thing?

Edit: I have looked around, it is likely to be a quirk of my keyboard. I suppose there is no work around. Presumably with the makey makey there will be no such problem.

I would like to finish this project this weekend (or at least the coding part, which will be very quick). Then I have to do the construction work, that will take a little longer… I’ll keep you updated.

1 Like

On input you enable a flag saying a key is held down. Then at the end of your on update function you set those flags as false. Now you can detect if multiple keys are held down at once by checking the states of the flags.

Hi Pkeod, It’s a keyboard problem, I did a lot of debugging and that’s it.

Another question. What am I doing wrong here?

self.timer = 100
self.timergoal=self.timer - 1
go.animate("#", “timer”, go.PLAYBACK_ONCE_FORWARD, self.timergoal, go.EASING_LINEAR, 1, 1, timerdone)
end

Is self.timer defined as a property?

You also have a delay on one second on, if it is that that is catching you of guard.

2 Likes

Thanks for your reply Mattias.

You’re right, self.timer is not a property. I thought that self.timer was a property because I’ve written self.timer = 100. What is “self.timer” then, if not a property?

Well, it is a property of self, yes, but to use go.animate on it, it specifically needs to be a “Script Property”, which you must define in the top level of your script with go.property().

5 Likes

Thanks Ross. I had not understood that distinction.

1 Like

The new project is going well.

4 Likes