Android :: Avoiding Float Operations In Game Design

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?

Android :: Avoiding float operations in game design


Android :: Design Application With Multiples Activities And Operations Running In Background?

Nov 22, 2010

I am designing an app that will have some activities separated in tabs. Some of them will have to perform tasks in the background will the user is in another tab. What is the best strategy for designing an app like this? I was thinking about using a service but it can be killed by android dalvik, isnt it?

View 1 Replies View Related

Games :: New Game Description - Avoiding

May 9, 2010

My first android game is nearly ready and its already in the market.

I hope you could give me some good feedbacks.

QR - Code:
http://fs01.androidpit.info/aqr/x76/370976-1272358669695.png

Little screen with explanations:
http://fs01.androidpit.info/ass/x70/200570-1273055185311-160x240.jpg

It has global highscore.

Game discription:
The goal is to collect boxes using the touchscreen to control the avoider, while avoiding the red smileys that move around the map to avoid death.
(100 Boxes comes with the next update in 2 days)
You have to collect the 100 boxes that appear one at a time on screen using the avoider. Each time a box is hit with the avoider a new box will be revealed at a different place on the field. With every box picked however,a red smiley will materialize as well. These move across the screen in various speeds and directions. Every box collected gives 1 to 5 points, depending on the time taken to pick it and increase the red smiley speed. Apart from getting less points when being slow, the avoider will also slowly grow bigger if it doesn't pick a box. It regains its original small size after picking up a box.

Every 15 boxes a green smiley will appear from the left hand side of the screen. When the avoider touches it, it goes into 'rage', meaning it will temporarily change into a big evil avoider that can eat the red ones, who now are the grey ones. The rage lasts for about 3,5 seconds, with every red smiley eaten counting as a point, which makes the game easier after the rage.

If you kill more then 15 boxes in a row, you gain the difference between the kills and 15 as bonus points for each pointbox. It will be shown next to the box. One important feature is the 'slowmo'. With every eaten pointbox a bar fills to a maximum of 10 seconds. You can activate it anytime by making an doubletab everywhere on the screen. The red smileys will move very slowly, allowing the avoider to maneuver easily.

The last feature is the bomb. You have one at start and about ~ 50 eaten point boxes it will appear an new bomb falling down the screen. You can only have one bomb at time. You activate it by making a doubletab on the bomb icon. Is has the affect, that all smileys die instantly.

*add I hope you enjoy it. Now I have implemented a integrated highscorelist (scoreloop)

Scoreloop Community | Avoiding. Have fun!

View 8 Replies View Related

Android :: UI Design For Board Game

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

Android :: SurfaceViews Handling / Thread And General Game Design

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

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 View Related

Android :: Which Is The Best Design For An Android Game

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

Android :: GUI Design - Mockup Design Tool For Android Application

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

Android :: Subtracting A Float From Another

Jul 18, 2009

Double mChange = Double.parseDouble("7.1") - Double.parseDouble ("7.15"); Float mChange = Float.parseFloat("7.1") - Float.parseFloat("7.15"); mChange should be -0,05 in both cases, right? So why is mChangeD = -0.05000019 ???

View 5 Replies View Related

Android :: Same Value When Converting From String To Float

Jul 8, 2010

I have a JSON Object with a latitude and longitude String on which I get the values doing this: String latitude = picInfo.getString("latitude"); String longitude = picInfo.getString("longitude");Then I convert them to floats like this: float latInt = Float.valueOf(latitude).floatValue(); float longInt = Float.valueOf(longitude).floatValue();And place them on a GeoPoint like this: GeoPoint X = new GeoPoint((int) (latInt*1E6),(int) (longInt*1E6) ); Debugging this values I can see JAVA approximates the values, is there anyway to keep them exactly the same?

View 6 Replies View Related

Android :: String From EditText To Float

Nov 19, 2010

I have an EditText for which will be using for a float number. So I'm trying to read the text from the EditText and put it into a float variable. But I seem to have a text to float problem.I've tried using Float.parseFloat(string) and just general casting, but nothing seem to do it. What can I do here? Also, is there a way to check for a valid float number before writing it to a variable?

View 1 Replies View Related

Android :: SeekBar Minimum And Continuous Float Value Attributes

Jun 9, 2010

I'm looking for a way to implement a minimum value in my SeekBar and also have the option to increment decimal numbers. For example, currently my SeekBar's minimum is set to 0, but I need it to start at the value 0.2. Also, I would like to have the functionality to be able to have the user select a number from 0.2 to 10.0 at a .1 precision so they can choose the numbers 5.6 or 7.1.

Here are the style attributes for my SeekBar:

CODE:..............

View 1 Replies View Related

Android :: Get User Input And Turning It Into Int , Double / Float?

Jun 19, 2010

Does anyone know how to get user input for floats,doubles,ints. I have tried looking everywhere on here and there hasn't been anything that could help me. All it has is EditText.GetText().toString() very frustrated that there isn't a tutorial for this.

View 2 Replies View Related

Android :: Storing Float Numbers As Strings In Database

Apr 27, 2010

So I have an app where I put arbitrary strings in a database and later extract them like this:

CODE:......................

This works fine in all cases except for when the string looks like a float number, for example "221.123123123". After saving it to the database I can extract the database to my computer and look inside it with a DB-viewer, and the saved number is correct. However, when using cursor.getString() the string "221.123" is returned. I cant for the life of me understand how I can prevent this. I guess I could do a cursor.getDouble() on every single string to see if this gives a better result, but that feels sooo ugly and inefficient.

I just made a small test program. This program prints "result: 123.123", when I would like it to print "result: 123.123123123"

CODE:.................

View 1 Replies View Related

Android :: Do Network Operations In Appwidget?

Aug 22, 2010

I'm developing a Android AppWidget for my application. For updating my appwidget I need to download data from network. But when I try to do that in onUpdate method, my appWidget is killed by Android system. I learnt that time consuming operations can't be done in receivers so I launched a service from onUpdate method and launched a thread from that. But still the problem persists.
Can anyone please let me know how to do network operations in Appwidget?

View 1 Replies View Related

Android :: Read A Float Value Form Resources And Accessed From Code?

Dec 3, 2009

Reading values like integers, strings, colors, etc. from resources (xml files) is easy and well defined at http://developer.android.com/guide/topics/resources/available-resourc.... But what about a float value, like 0.1 or 1.4? How can such float value be defined in resource file and accessed from code? Is it possible at all?

View 3 Replies View Related

Android :: Handling Expensive Operations In UI Thread

Sep 16, 2009

OK I'm reading this page:
http://developer.android.com/guide/appendix/faq/commontasks.html#thre...

The code is as in the example (see below). In my application, the worker thread has done loading of large bitmaps, and I need to notify the UI thread the filename of the bitmap that was loaded as they get loaded. How can I notify the UI thread of the filename of the bitmap just loaded? I can see anyway to for updateResultsInUi() to be able to take a parameter from the example below.

public class MyActivity extends Activity {
[ . . . ]
// Need handler for callbacks to the UI thread final Handler mHandler = new Handler();
// Create runnable for posting final Runnable mUpdateResults = new Runnable() { public void run() { updateResultsInUi();
} };
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
[ . . . ]
} protected void startLongRunningOperation() {
// Fire off a thread to do some work that we shouldn't do directly in the UI thread
Thread t = new Thread() { public void run() {
mResults = doSomethingExpensive();
mHandler.post(mUpdateResults);
} };
t.start();
} private void updateResultsInUi() {
// Back in the UI thread -- update our UI elements based on the data in mResults
[ . . . ]
}

View 5 Replies View Related

Android :: Stop Threads With Long Operations?

Aug 28, 2009

Android experts, I have a tricky question that I would like some advice on. code...

View 8 Replies View Related

Android :: Composite Operations In Droid Canvas?

Mar 31, 2010

I'm just starting with Android development and I'm coming from JavaScript/HTML world so I'm currently investigating the possibilities of the Android SDK.

The HTML 5 canvas supports composite operations (See here).

Is this possible in an Android Canvas? I scanned the API of the Canvas class but couldn't find anything useful. I need at least the composite operation "source-in" or (if this isn't possible) "source-atop".

View 3 Replies View Related

Android :: JUnit Testing Database Operations?

Oct 18, 2010

I'm developing an Android application with database storage.

I want to test some classes that I use to access database.

I've found ActivityInstrumentationTestCase2 to test Activities but I haven't found anything to test classes.

How can I do that? I haven't used jUnit before.

View 1 Replies View Related

Android :: Low Level Operations With SD Card On Droid?

Nov 13, 2010

Is it possible to have low level access in Android with Java/NDK to create for example card scanner like scandisk or card defragmenter? I move a lots of stuff around my card and it gets fragmented quickly. I have experience with FAT32 defragmenting on Windows, but I'dliek to do this on Android.

View 2 Replies View Related

Android : Some Tutorials About Operations On Droid Emulator?

Mar 6, 2010

Can any body give me some tutorials about operations on the android emulator ?

View 2 Replies View Related

General :: Galaxy S4 Android 4.4 / Program Crashes Operations

Nov 27, 2013

I've downloaded the android 4.4, but when i'm going to settings, security, the program crash the operations.

gti9505G
I9505XXUEMJ7
COMPILATION: KRT16S.S005.13116

I want to mark the option install apps out of play store.

View 1 Replies View Related

Android :: One Line Causing Lots Of Garbage Collection.String.format With Float?

Apr 13, 2009

In my ListView, there's one line of code in my ViewBinder that causes lots of garbage collection as I scroll through the list, about every two seconds...

D/dalvikvm(16312): GC freed 13171 objects / 659576 bytes in 162ms D/dalvikvm(16312): GC freed 13122 objects / 654128 bytes in 129ms D/dalvikvm(16312): GC freed 13134 objects / 655416 bytes in 142ms D/dalvikvm(16312): GC freed 13129 objects / 654840 bytes in 129ms D/dalvikvm(16312): GC freed 13149 objects / 655000 bytes in 110ms D/dalvikvm(16312): GC freed 13150 objects / 655720 bytes in 127ms D/dalvikvm(16312): GC freed 13075 objects / 652256 bytes in 111ms D/dalvikvm(16312): GC freed 13232 objects / 659040 bytes in 136ms D/dalvikvm(16312): GC freed 13106 objects / 653920 bytes in 110ms D/dalvikvm(16312): GC freed 13155 objects / 655152 bytes in 110ms

The offending code is here, which formats a price for each item in the list: String price = cursor.getString(columnIndex); final float pricef = Float.parseFloat(price); price = new StringBuffer("$").append(String.format("%. 2f",pricef)).toString(); ((TextView)view).setText(price);

If I comment out the line with String.format, the garbage collection goes away. So what's the "right" way to do this to avoid allocations? That database field holds an unformatted text string which I'm trying to format into proper currency format (example: format "1.5" to "$1.50")

View 9 Replies View Related

Android :: Need Droid Apps That Alter Normal Phone Operations

Feb 19, 2010

So i was wondering if its possible to for an application that i would write to be constantly running in the background and alter regular phone operations. For example this could be something like as soon as you receive a text from anyone you forward it automatically to another number. Is something like this at all possible? Just to be clear I don't want to solve that particular problem through some other means, just want to know if apps can accomplish that. Also if that is possible is it possible for an app that i write to alter more immediate and instant things, like an incoming call.

View 1 Replies View Related

Saving Values From (Float) ArrayList Into A Bundle

Dec 4, 2012

I'm writing a game using Surfaceview and have a question relating to saving Data into a Bundle.

Initially, I had an arraylist which stored the Y co-ordinates (in the form of Integers) of sprites that will move only up and down. Declared as:

Quote:

static ArrayList<Integer> ycoordinates = new ArrayList<Integer>();

I saved them to a Bundle using the following:

Quote:

myBundle.putIntegerArrayList("myycoordinates", ycoordinates);

And restored them using this:

Quote:

ycoordinates.addAll(savedState.getIntegerArrayList ("ycoordinates"));

This all worked perfectly. However, I've had to change the whole coordinates system so it's based on Delta time to allow my sprites to move at a uniform speed across different screens. This is, again, working perfectly.

However, as a result of this change, I now have to store these values as floats rather than integers.

So, I am declaring as:

Quote:

static ArrayList<Float> ycoordinates = new ArrayList<Float>();

So that's the background, now my question is, how do I store and restore values from a Float Arraylist? There doesn't seem to be a "putFloatArrayList" or "getFloatArrayList".

(I've used an Arraylist rather than an Array as the number of sprites needs to be dynamic).

View 1 Replies View Related

Android :: File Operations Extremely Slow On Emulator - Totally Stuck

Jul 19, 2010

I am finding that file operations are extremely slow on emulator. The same operation which takes less than a few seconds in a real device, takes minutes on an emulator. I am using a ubuntu linux machine with 2.4Ghz CPU, 2 GB Ram. I would really appreciate any help in resolving this. I am totally stuck due to this.

View 2 Replies View Related

Motorola Droid :: Cloud Effect That Float By On Screen?

Aug 23, 2010

what are these clouds that float by on my screen every time I turn on the Droid? Did I miss something somewhere, is it a android thing or my weather program? How can I turn it off?

View 11 Replies View Related

Android :: Avoiding Compression On Large Files

Sep 29, 2010

Apparently you can't have a file in "assets" larger than 1MB (except for certain file types) because it's considered too large to uncompress. But I'm finding mixed info about how to circumvent this limitation. Some say that you can put the files in "raw" and avoid the limitation but others say that files in "raw" are compressed too.And there's the -0 aapt option that can be used to turn off compression for certain file types, but there's no way to specify aapt options in Carbide. I realize that I can break the file into pieces, but that's error- prone on both ends.And using one of the known uncompressed file types not only confuses things but also runs the risk that the Android PTB will decide to start compressing that file type.

View 6 Replies View Related

Android :: Avoiding Image Compression On Some 3G Networks

Jul 3, 2010

I want to download an image from the 'net and set it as the users background. This works great over wi-fi, and some 3G networks, but others (T-Mobile UK, for sure) seem to compress the images before sending them. This effect is noticeable when using the browser, too - however, if you long press on an image and save it, when viewing in the gallery it is either not compressed at all, or substantially less so. I want to be able to do this in my own app.I assume it has something to do with the HTTP headers, but of the ones I've modified, none has made a difference.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved