dev42
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2012
09:54 PM
game dev: diagonal movement
is it possible to catch 2 keypresses before one is released and "manufacture" diagonal movement?
6 REPLIES 6
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2012
11:47 PM
Re: game dev: diagonal movement
I tried it on v3.x of the firmware and it isn't possible. I'll try it on v4.x tomorrow.
-JT
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
dev42
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2012
04:29 PM
Re: game dev: diagonal movement
I'm guessing it is possible with the "NDK" but wasn't certain if it was something wrong with how I was accessing it via BrightScript. FWIW, I've been using the Snake demo as a starting point.
Interestingly, the limitation is causing some creative problem solving. Instead of holding down a direction and then hitting the "jump" button, hitting and releasing the direction would cause the character to move until told to stop. Then with the character moving, hitting the jump button would jump. I'm not sure if this would be too much for old school gamers to learn, but it might be OK for newcomers. 😉
Of course, that doesn't exactly fix the 45 degree direction problem, but if a similar approach is used, a special key combination, for example, could "rotate" the player to different headings. In that, the limitation becomes a plus as then we aren't limited to 45 degree turns.
Thanks for looking into it.
Interestingly, the limitation is causing some creative problem solving. Instead of holding down a direction and then hitting the "jump" button, hitting and releasing the direction would cause the character to move until told to stop. Then with the character moving, hitting the jump button would jump. I'm not sure if this would be too much for old school gamers to learn, but it might be OK for newcomers. 😉
Of course, that doesn't exactly fix the 45 degree direction problem, but if a similar approach is used, a special key combination, for example, could "rotate" the player to different headings. In that, the limitation becomes a plus as then we aren't limited to 45 degree turns.
Thanks for looking into it.
RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2012
10:11 AM
Re: game dev: diagonal movement
I haven't tested this, but it seems to me that you could set up some timers and use them to ignore key-release events for a few milliseconds after receipt of an key-press event, and get your diagonal movement that way, you could use timers to create additional composite events like "double click" or "click and hold" to give multiple behaviors to a single key.
- Joel
- Joel
dev42
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2012
03:59 PM
Re: game dev: diagonal movement
Does this confirm that multiple KEY_PRESSED events cannot currently happen? Will that functionality ever be available in Brightscript?
Even so, thanks for the ideas.
I like the double click / multiple functionality for a button.
Even so, thanks for the ideas.
I like the double click / multiple functionality for a button.
MazeWizzard
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2012
05:36 AM
Re: game dev: diagonal movement
It requires a lot of creativity on the developer's part. There are different remotes too. The ergonomics of it (diagonals) are different with the + type of button compared to the square button.
Also, the more common one I was looking for was to have a "fire/jump" button that could be pressed along with the movement. Alas, I would not want it to be "sticky" but rather timed.
This may be solved if B.Script could access the game remote's motion sensors. Of course, you would then have to require a game remote and appropriate box.
I THINK that the box guarantees that a key release event is generated for each press... but I haven't checked the order of the events in a while. Not uncommon since an IR remote can be "lost" or blocked and cause a key release that would otherwise be missed.
Maybe they could sense whether it was an IR remote or game remote and handle it differently. Or have a switch for the API that could take multiple key presses for the game remote (since it's not IR, maybe they don't have to generate a guaranteed key up event before the next key press?).
Also, the more common one I was looking for was to have a "fire/jump" button that could be pressed along with the movement. Alas, I would not want it to be "sticky" but rather timed.
This may be solved if B.Script could access the game remote's motion sensors. Of course, you would then have to require a game remote and appropriate box.
I THINK that the box guarantees that a key release event is generated for each press... but I haven't checked the order of the events in a while. Not uncommon since an IR remote can be "lost" or blocked and cause a key release that would otherwise be missed.
Maybe they could sense whether it was an IR remote or game remote and handle it differently. Or have a switch for the API that could take multiple key presses for the game remote (since it's not IR, maybe they don't have to generate a guaranteed key up event before the next key press?).
dev42
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2012
10:33 PM
Re: game dev: diagonal movement
"MazeWizzard" wrote:
...Also, the more common one I was looking for was to have a "fire/jump" button that could be pressed along with the movement. Alas, I would not want it to be "sticky" but rather timed.
Totally agree with you, but if you consider Super Mario Bro's, 3 button's not 2 is required: "Direction" for run, button "A" for run faster, and button "B" for jump.
Even though I'd like to be able to do it "that way" I think that "Direction + release" to run followed by the same "Direction + release" to run faster and then have the player "time" the jump would work. It'd just be different than what everybody is used to.
That said, I think the "work around" for diagonal movement is more limiting... unless, yet again, our user base would be interested in playing Contra with only one button pressed at a time? Direction PRESSED & RELEASED to run and aim gun in same direction followed by "Up" to rotate gun up 45 degrees?? sorta gets that "diagonal movement" ?? then fire & jump buttons would be timed? along with, what?, opposite direction to stop? and same direction to either speed up and/or rotate gun back down?
Other than that, good thoughts about supporting older Roku boxes.
I think I'll search the forums and possibly start a new thread on how to release a game and be able to update it... and how to get (positive) feedback. 😉