Android :: How To Design "manual Animation" Into Droid Game Without Code Delays?
Oct 3, 2010
I am writing a game for Android and I think I have a fatal flaw in my architecture and/or code. The architecture is basically two threads, one that just continuously draws the screen and the other than controls the movement of the drawables on the screen based on the user's touch screen input. In the latter thread, I'm basically doing manual animation (insert correct term here), meaning I move the drawables on the screen via methods that change the Drawables Rect as the game progresses. The "no-no" I believe I'm doing is inserting delays into these methods, so that it "appears like an actual animation." This all works fine and dandy because I have no reason to process any user input during these animations, but it's really bugging me that I'm designing a flaw into a lot of hard work with my game. I'm sure many of you can relate to this in terms of code design.
View 3 Replies
Jan 5, 2010
I need to design a board UI using android platform. I was planning to take one image as board and moving the required images over the board. How do I achieve the same? I need to find the coordinates for image and need to move the required images to specifies coordinates. Is there any andorid API for this?
View 2 Replies
View Related
Jun 8, 2010
I've read this in a few articles, that one should avoid floating point operations within the physics update of a game.
But how do you really achieve this? Surely all half decent games are going to involve this kind of maths?
Does it mean, convert all your variables to int, or use double instead, or simply just cut it out as much as possible?
View 9 Replies
View Related
Jul 14, 2009
I'm a new Android developer. I would like to make a simple game using the SurfaceView (Canvas drawing).the game has a a custom Object name Box. Box can draw itself and need to get an event when it is clicked. when it does, there is an animation sequence coming out of the box like a "jumping clown". I have several Boxes on the screen when each of them can be activated. Several Boxes animation can also be presented simultaneously.Here it gets tricky: Since I have a "complicated" animation sequence, each Box extends SurfaceView. The problem is I haven't figured it out how can I handle several SurfaceView's drawing using only one Thread (in order to present an animation I need to use one) and also how can I get the onClick/ onThouch event from my Activity to each of my Boxes.
The LunarLanding example in the SDK uses only one Thread but also uses only one SurfaceView which manage the animation of the game components (there are no several game components SurfaceViews). Also, there is no need to get onTouch event, so this example doesn't match to my case. I have several questions about what is the right approach do code this:
1. Should I use Box extends SurfaceView?
2. Can SurfaceView gets user events like onTouch/onClick?
3. Is there a way to add to the "main" SurfaceView another SurfaceView (Box)?
4. If none of the above questions is positive, should I use one SurfaceView (and one Thread) and try to map the other Boxes on the screen for user event handling. I mean Box only paints itself but the user event is being handled by me (not by the OS).
5. Should each Box (SurfaceView) should handle it's own Thread in case of animation (it is not good design but it is also an option)?
6. do you have any other proposal?
View 4 Replies
View Related
Oct 8, 2009
Is anyone aware of an example or sample code that shows how to make a settings page (like what you get from hitting settings)? Many apps seem to have them but I'm not sure what type of list they are using.
View 4 Replies
View Related
Apr 6, 2010
I've got a common task that I do with some Activities - downloading data then displaying it. I've got the downloading part down pat; it is, of course, a little tricky due to the possibility of the user changing the orientation or cancelling the Activity before the download is complete, but the code is there. There is enough code handling these cases such that I don't want to have to copy/paste it to each Activity I have, so I thought to create an abstract subclass Activity itself such that it handles a single background download which then launches a method which fills the page with data.
This all works. The issue is that, due to single inheritance, I am forced to recreate the exact same class for any other type of Activity - for example, I use Activity, ListActivity and MapActivity. To use the same technique for all three requires three duplicate classes, except each extends a different Activity.
Is there a design pattern that can cut down on the code duplication? As it stands, I have saved much duplication already, but it pains me to see the exact same code in three classes just so that they each subclass a different type of Activity.
Edit: Since it seems I need to be a bit more specific...
Suppose I'm trying to solve the problem of an AsyncTask background download during orientation changes. The solution I have right now is to use callbacks; there's download manager that I have which starts these downloads, and then I have the Activity attach a callback to it. When the orientation changes the Activity is destroyed and then recreated; during this process I detach the old Activity's callback, then attach a new callback from the new Activity afterwards.
Orientation changes are a common problem, and in multiple Activities I start the Activity with a progress view while the data loads. What I am trying to solve is not having to re-implement this orientation-handling logic ten times over; my initial solution was to subclass Activity, but then I got the problem above.
View 4 Replies
View Related
Aug 17, 2010
I have been working on Android for a few months. Now i want to jump to gaming in Android. So are there any resources, ebooks, or tutorial where I can study game development be it 2D or 3D.
View 1 Replies
View Related
Apr 3, 2009
Just starting a little game project and have a super basic question. what's the best way to store animation images for a game? I looked at the alien bloodbath code and they store multiple frames in a single png file. Is that the preferred way or is there easier/better way to do it? MP4?
View 2 Replies
View Related
Feb 16, 2009
I wanted to know that how to use sound in animation,Actually i wanted to create a online bidding game and i want to use sounds in that animation.
Can u let me know how to do this.
View 2 Replies
View Related
Jun 23, 2010
I was able to get the animation to work on the emulator -- however my problem is that it animates for a second, but then then goes back to its original posistion right after it finishes animating. How can I stop this for happening.
This is how I animate my objects:
CODE:.................
View 2 Replies
View Related
Sep 2, 2010
http://www.facebook.com/#!/album.php?aid=2042525&id=1549646802
The url above is an album of my facebook. Could u pls tell me which is better, the yellow, or the green?
View 2 Replies
View Related
Oct 6, 2010
I have implemented rotation of a custom view which runs perfectly on Emulator,but the screen goes blank without any error. When i disable the animation in code[commenting the lines] the view appears on device.
Please help me out. if there is any fox for this.
View 1 Replies
View Related
Feb 17, 2010
I am creating a game using the irrlicht c++ 3D graphics engine port to android platform. The graphics engine is written in c++. I need to be able to load meshes and textures etc from c++ code. My current plan is to place all the game asset files in either the res/raw directory or the assets directory then on start-up copy these files to the sdcard so they are accessible from the irrlicht c++ code.Is this the best way to make the game media files accessible from c++?
View 2 Replies
View Related
May 26, 2010
I've noticed this start to happen more and more frequently. I will get a text, say at 7:30, and not get a notification until I check the app, or my phone will vibrate and say I got the text anywhere from 5 to 15 minutes after it actually got to my phone (observed). This doesn't happen all the time, mind you. Anyone else notice this? It's annoying because I'll get a text and I won't KNOW I got it until a while after. It also seems to only happen if I haven't gotten a text in a certain period of time. Like, the longer I go without receiving a text, the longer it will take for Chomp to give me my notification. Again this doesn't happen all the time but it does happen and I'm not sure if I've just been noticing it more or what is happening.
I did a factory reset when I got the 2.1 OTA so I guess it's not something that could fix, unlike the saving attachments issue I had before the reset. The only thing I can think of is the length of a thread I have on here, it has about 600 messages in it. But I've had threads with 1000+ messages and haven't had a problem before.
View 2 Replies
View Related
Dec 15, 2009
I was trying to do a memory game on android, but i can't figure out the code that matching 2 button with the same image..
CODE:..................
View 1 Replies
View Related
Nov 17, 2010
I'm fading out an imageview with alpha animation. I'd like the image to stay transparent after the animation. Tried with different combinations of fillAfter and fillEnabled, no luck. How can this be achieved?
View 1 Replies
View Related
Jan 13, 2010
I tried searching the forum for this problem but it seems I can't find it (there might be one out there ) Anyway, so I have a Droid Eris. The problem is that when my phone is in SLEEP mode, it takes about 10-30 seconds for my phone to AWAKEN when receiving a text message and around 10 rings (from the caller) for my phone to AWAKEN start ringing. But when my phone AWAKE, I receive texts/calls right away. I have two phones so I constantly test it out and results are the same. Do you think some of my apps are delaying it? My default SMS app is Handcent and configured properly. Do you think Automatic Task Killer is the culprit (this kills all apps when in SLEEP mode)? But even if I exclude MESSAGES, VOICE DIALER and HANDCENT, I still get the delays.
View 3 Replies
View Related
Nov 8, 2010
I am using the Snake Demo as a base learning tool. Question I have is if I use parts of it, modified bigtime, can I use the code in my game release legally?
View 3 Replies
View Related
Nov 23, 2010
I am going to develop an Android Application but before developing it i needs to have MockUp for the Android Application,so is there any way to design MockUp/GUI Design tool for the Android Application?
I know about DroidDraw tool , but i think it is not the exact way to prepare Mockup for the android application.
I have already referred this SO Question , but overthere i just found all the tools for the I-Phone only. So please feel free to share with me if you have/found any !
View 3 Replies
View Related
Aug 19, 2010
I have a simple app that just initiates a wifi scan every two seconds and then logs the results. I am observing some strange behaviour, and was wondering if anyone could shed some light. When I start scanning, if the phone (Nexus One running latest Froyo OTA release) is just sitting on my desk (screen on or off, it doesn't matter), I receive the wifi scan results about 800ms after initiating the scan, fairly consistently. At most, it takes a second and a half to receive the results. However, if I get up and start to walk around the building that I'm in, the time between initiating the scan and receiving the result begins to vary greatly. What is interesting is that I start to see a pattern where it will take about 40 seconds to receive results, then I will get three or four results two seconds apart, then it takes 40 seconds to receive the next set of results, then I get three or four results two seconds apart, etc.
I've tried obtaining a wifilock, both the FULL and SCAN ones, and that doesn't help. Same with a partial wakelock. I've also tried setting up a thread that pings the supplicant every second and reports when it is unreachable, and it appears to always be responsive (ie., I never see the report). I thought that maybe the problem was that I am unable to receive the result of scans when I am switching between base stations (which might happen when I move around), but if I manually switch between two different networks, it does not cause a delay in my scans (ie., I can still get the results with only a one second delay while it's associating with the new network). Anyway, for my application, it would be incredibly useful to get wifi results at a fairly consistent rate, and so I was hoping that someone on this list might have some suggestions as to how I can achieve this.
View 2 Replies
View Related
Dec 27, 2009
I've been getting delays when launching and exiting Handcent...not 100% of the time, but much of the time it takes forever (like >6 seconds) to launch or for my home screen to appear after exiting.
View 7 Replies
View Related
Apr 13, 2010
We are developing an Android video conferencing application. After examining some already existing live-stream applications , we came to the conclusion that all or almost all existing applications have a delay of 3 to 10 seconds. The application we are developing was tested receiving a video stream on the Android device and the same video stream on VLC at the same time.The result of the test is that VLC shows the same part of the video 2 to 10 seconds earlier than our Android application on the phone(HTC hero) depending on the rtsp link used. we haven't found what is the main cause of the delay and also dont know if it is possible to reduce that delay. In our case, as it comes to video conferencing, the delay should be lower than 2 seconds at least. Do you guys have some information about the cause of the delay or even how to reduce it?
View 5 Replies
View Related
Oct 14, 2010
I don't remember my DroidX always doing this, but recently after I hang-up from a call it shows the "Call Time XX:XX" in the center of the screen and I can't do anything until it goes away, which is generally 5-8 seconds. Hitting Home, Back, etc does nothing and tapping on the screen or the message also does nothing.Is this a setting I can disable? I can look at the recent calls to get the length of call if I need to see it, so I don't need the dramatic pause to give me this info.
View 2 Replies
View Related
Mar 20, 2010
I'm performance tuning interactive games in Java for the Android platform. Once in a while there is a hiccup in drawing and interaction for garbage collection. Usually it's less than one tenth of a second, but sometimes it can be as large as 200ms on very slow devices. I am using the ddms profiler (part of the Android SDK) to search out where my memory allocations come from and excise them from my inner drawing and logic loops. The worst offender had been short loops done like,
for(GameObject gob : interactiveObjects)
gob.onDraw(canvas);........................
View 3 Replies
View Related
Aug 30, 2010
I have a strange issue - from time to time the animation that should fade out my control (ImageButton) does not kick in immediately. I am using the fadeout animation to hide it and then in myListener on its end (onAnimationEnd) I put new resource as the image on the button.
Somewhere in my app code:
Animation a = AnimationUtils.loadAnimation(this,R.anim.fadeout); a.setAnimationListener(new myListener(location)); buttons[location].setAnimation(a); a.startNow(); // regardless if its start() or startnNow() it will work in most of the cases but not 100% reliable I actually can see in debug Log when its late, happens after few more clicks
Then in myListener.onAnimationEnd(Animation a):buttons[location].setImageResource(R.drawable.standard_button);
Seems there is a rule that the every 4th or 5th animation does not start ...
View 1 Replies
View Related
Apr 14, 2010
I have already posted my query here, but unfortunately, not getting the required support for this simple query.
I am using a progressbar widget in my application to show the download progress.
In the current state, I am able to manually move the slider back and forth while download is progressing. How can I prevent the manual moving of progressbar, instead it works only based on
progressbar.setProgress(progressbar.getProgress() + 1024); -- currently this works perfect, but I need to prevent the manual moving of progressbar during download.
View 1 Replies
View Related
Nov 3, 2009
I've got a tab host activity started from a home screen shortcut. When my application starts it downloads information from a server using an AsyncTask. In the onPostExecute method of the AsyncTask I call setContentView to display the TabHost.When I start the homescreen shortcut by tapping on the shortcut using my finger everything works as expected, I download the information from the server and display the TabHost with the information in the tabs. However starting the application by navigating to the shortcut with the mouse wheel and then clicking on the shortcut with the mouse wheel leads to a trap in the framework code as soon as my application starts. This looks like a simple fix since mCurrentView is null at the time that this method is called - can this issue be addressed? Does anyone know of any workarounds?
View 5 Replies
View Related
May 5, 2010
I have an odd issue. When I get an email, it sounds immediately. But when I go to read the email, it's not on my phone yet. It makes the sound, but does not show any message indication. About a minute or two later, the message shows up.
View 3 Replies
View Related
Apr 28, 2010
While programming on Android, I end up writing a parent activity which is extended by several others. A bit like ListActivity. My parent activity extends Activity. if I intend to use a Map or a List, I can't use my parent activity as superclass - the child activity can only extend one activity obviously. As such I end up writing my parent activities with the same logic for Activity, ListActivity, MapActivity and so forth.
What am I looking for is some sort of trait functionality/design pattern which would help in this case. Any suggestions?
View 3 Replies
View Related
Feb 23, 2010
Does the Android platform lend itself well to a particular style of UI programming like MVC or MVP? Most of my UI experience is with spaghetti code on a very old embedded device or in GWT with MVP so I do not know where to start.
View 3 Replies
View Related