Actually I'm developing a simple game. In my game, I need to connect multiple buttons by swiping. But I don't know which events should I use to do that. What I want is kind of similar to Candy Crush game.
Please help me out guys!
Take a look at Handling pointer input on MSDN, specifically the PointerPressed, PointerMoved, and PointerReleased events. You can keep track of the pointer information by making use of the PointerRoutedEventArgs argument passed in those events, including checking whether the pointer belongs to a mouse or if it is brought about by touching the screen. There are some good examples in each article.
Related
I am at the early stages of developing a 2d shooter game (Picture Metal Slug) using JAVA. I want to be able to shoot many bullets at the time. In order to do so i use a Set to control the current bullets on the screen, each time you click you spam a bullet, adding it to the screen and to the set of bullets (so in each frame, you move each bullet in the set according to their speed).
My problem is that if I click fast enough I get an
ConcurrentModificationException
Is there a data structure able to add and remove fast enough different objects without getting such exception? I can not find any that suit me.
Thanks in advance
The data structure able to suit your requirements is a ConcurrentHashMap, check:
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html
i am working on an application ( game sorta ) which uses the kinect as an input device.
i need a "moderator" to be able to reset the application once new users are interested.
i was thinking that covering the sensor with a hand for some seconds could do the trick.
however the only way to achieve that would be to analyze the rgb camera output all the time for "all black".
any thoughts on this?
thanks a lot.
p.s.: i am using the openni sdk on mac and the game is developed in as3 using the airkinect framework.
What you mentioned sounds like a fair solution. On similar lines you could even use the depth sensor and detect the depth as (approx) 0 to trigger the reset.
However, I can come up with cases where using either one solution may be a false positive. Keeping it simple for the user, you might even want to use a combination of zero depth and all black for this.
Making it complex and accurate you could use a QR code or a RED Paper to indicate (STOP). A GREEN (for GO), etc.
(Kindly mark this solution as accepted if you find it sufficient. Awaiting your comments, if any.)
My first thought would be using voice recognition instead. It seems like a more natural interaction than covering the sensor. If you keep the voice commands limited it works very well.
I've used voice recognition in the past to determine the leftmost and rightmost edge of a "playfield" by holding my hand on one of the edges and saying "calibrate", "left", "right", and "Okay" to confirm. It worked very well. If you have a lot of people talking, you could listen for a keyphrase first. So "Kinect: calibrate" and "Kinect: left" to filter out the false positives.
You should first answer the question of how the user and moderator will be interacting with the application and the active interaction space. If a moderator has to approach the Kinect sensor and cover up the camera in order to reset the instance, why not just give them a wireless keyboard or mouse to hold? A mouse click or a keystroke can reset the scene in this case -- and a keyboard would offer many other keys to jump between multiple scenes, or configuration settings.
If you are truly needing a "hands free" solution for the moderator, I would look into gestures or speech recognition. I'm not as familiar with OpenNI, so links below will reference Microsoft SDKs but can be used for reference and ideas...
In the case of speech recognition, an "activation" keyword can be used (e.g., "Kinect" or "Computer") followed by an action request (e.g., "Destruct sequence 3, code 1 B-2B-3", or just "reset" if you want to be boring). You can read more about speech recognition using Microsoft libraries here: http://msdn.microsoft.com/en-us/library/system.speech.recognition.aspx
For gestures, you can use a static gesture to reset the scene -- for example, on the XBox holding one arm at your side and the other a 45-degree angle will send you back to the main menu. You can always assume the moderator will be on a certain side, or will always be the second player to enter the scene. You could just not care and let users reset the scene if need be. You could also mix it up and have the moderator give a "control" gesture or voice command first, so the system knows they are the moderator, and then give the reset (or other) gesture.
Two gesture libraries that could help in this are here:
http://kinecttoolbox.codeplex.com/
https://github.com/EvilClosetMonkey/Fizbin.Kinect.Gestures
I am no expert in Flash, and I need some quick help here, without needing to learn everything from scratch.
Short story, I have to make a list where each cell contains an image, two labels, and a button.
List/Cell example:
img - label - label - button
img - label - label - button
As a Java-programmer, I have tried to quicly learn the syntax and visualness of Flash and AS3, but with no luck so far.
I have fairly understood the basics of movie clips etc.
I saw a tutorial on how to add a list, and add some text to it. So I dragged in a list, and in the code went list.addItem({label:"hello"}); , and that worked ofc. So i thought if I double-clicked the MC of the list, i would get to tweak some things. In there I have been wandering around different halls of cell-renderers etc.
I have now come to the point that I entered the CellRenderer_skinUp or something, and customized it to my liking. When this was done, I expected i could use list.addItem(); and get an empty "version" of my cell, with the img, labels and the button. But AS3 expects an input in addItem. From my object-oriented view, I am thinking that i have to create an object of the cell i have made, but i have no luck reaching it.. I tried to go
var test:CellRenderer = list.listItem;
list.addItem(test);
..But with no luck.
This is just for funsies, but I really want to make this work, however not so much that I am willing to read up on ALOT of Flash and AS3. I felt that I was closing in on the prize, but the compiler expected a semicolon after the variable (list.addItem({test:something});).
Note: If possible, I do NOT want this:
list.addItem({image:"src",label:"text",label"text",button:"text"});
Well.. It actually is what I want, but I would really like to custom-draw everything.
Does anyone get what I am trying to do, and has any answers for me? Am I approaching this the wrong way? I have searched the interwebs for custom list-cells, but with no luck.
Please, any guiding here is appreciated!
Sti
You could use a Datagrid as well, with each column pointing to the appropriate part of the data source (possibly even the same field, depending on what you're doing). You can then just use the ImageCell as the renderer for the second and third colums.
I think you're just not understanding that Adobe, in the own woolly-headed little way, is separating the Model from the View on your behalf. You hand the Model to the View and then get out of the way. The extent of what you can/should change is just telling it what renderer to pop your data into.
In fact, the fl.controls don't give you much control at all about how they work--I wouldn't go down the road of trying to create a custom itemRenderer with any signifcant functionality for them if you don't fully understand how the Display List works and if you're not comfortable digging around in the debugger and ferreting out all kinds of undocumented information.
For more details (to the extent anyone knows anything about how these work), see
http://www.adobe.com/devnet/flash/quickstart/datagrid_pt1.html
http://www.adobe.com/devnet/flash/quickstart/datagrid_pt2.htmlhttp://www.adobe.com/devnet/flash/quickstart/datagrid_pt3.html
http://www.adobe.com/devnet/flash/quickstart/tilelist_component_as3.html
Do you have the option to use the Flex Framework instead of pure Flash? It makes this kind of extension much more satisfying. It's aimed more at application developers, whereas Adobe sees Flash users more as designers.
Anybody know any good resources for touch interface in AS3? Maybe with example downloads of simple user interface examples such as swiping lists etc. I could write code that reacts to the mouse events but I was wondering if their is a more a intuitive way of doing it using the native touch events class? Thanks. I also believe better 3rd party classes are available but I would rather stick with the adobe classes right now unless you guys think otherwise?
Check out Multi Touch Gesture Applications and Responding to Raw Touch Data for a start.
Anyone know if it is possible via AS3 to change a button to its rollover state when it is not, in reality, rolled over?
Client decided way late in process to ask for some other elements to affect button states. If I had known I would have used movie clips instead of buttons.
Thanks for any advice.
Have you tried manually calling gotoAndStop(2) ?
If none of the above solutions work, you'll either have to subclass SimpleButton and link it to your symbols or rebuild in MovieClips
Dispatch the rollover event manually? Apart from that, I don't see any other way. I am curious though, what sort of requirement(s) would mandate such an oddity.
You can open the properties of any library display object and change it to a button, graphic, or movieclip type. this should allow you to then change the instance type to button and retain rollover abilities while allowing "gotoAndStop" actions on the instance. I'm not totally sure this works, and this thread is old, but if anyone has this same issue it would be worth a shot. This is assuming you aren't creating SimpleButtons dynamically.