gravity

How do I apply gravity to my bouncing ball application?

I've written a fairly simple java application that allows you to drag your mouse and based on the length of the mouse drag you did, it will shoot a ball in that direction, bouncing off walls as it goes. Here is a quick screenshot: Each one of the circles on the screen is a Ball object. The balls movement is broken down into an x and ...

Collisions between game objects and the floor with regards to gravity?

How do games with gravity handle the relationship between moving things like players, monsters, or objects and the floor? Is the player constantly "falling into" the floor and being bounced back up? Two ways to react to collisions that I have found are moving the player back to his previous location before the collision, and testing ...

How do I create dynamically text in a movie clip using as3?

I would like to create text animated like a comet. I would like to create a gravity effect, accelerate the movie clip on vector, set a starting position on stage and load the text from a xml file. ...

iphone cocos2d's chipmunk - Center of gravity

Hello wonderful people ! Here is my problem. I have a chipmunk's rigid body (a soda can standing up) that i want to change its center of gravity to the bottom of the object so it can fall on its flank when a force is applied to its upper part. Am I on the right track? 1) For some reason, I am having trouble setting the body's center ...

Drag elements around with gravity effect

I want to accomplish something similar to what photoshop.com has and this site here: http://mrdoob.com/projects/chromeexperiments/google_gravity/ Does anyone know how to do this with javascript (preferably jquery) ? ...

Gravity Sort : Is this possible programatically?

Hi, I've been thinking recently on using the Object Oriented design in the sorting algorithm. However I was not able to find a proper way to even come closer in making this sorting algorithm that does the sorting in O(n) time. Ok, here is what I've been thinking for a week. I have a set of input data. I will assign a mass to each of t...

Is there an example for mark with right gravit?

Quoted from here: The standard left-to-right cursor is a mark with right gravity (when you type, the cursor stays on the right side of the text you're typing). Now I see what's an mark with right gravity. But I still don't have an idea what's a mark with left gravity like,is there an example of left gravity mark? ...

iPhone tilt direction

Hi all, I am making a simple, tilt controlled game using UIKit. So far, when I tilt the device the character moves in the appropriate direction. What I want him to do is to change the direction he is facing when I tilt the device. For example, when I tilt it left, I want the character to face left. Is there a way to detect whether th...

Help starting a bobblehead effect?

I have no working code at all, but I'll post my method of display the image I need to bobble. public void onDraw(Canvas can){ can.drawBitmap(bobbleHead , xpos, ypos, p); } I have xpos and ypos declared. ...

How do I implement multiple sources of gravity, specifically the trig required. (C#) VS 2010

Hi guys. I am designing a small game wherein objects are attracted by multiple objects at once. What I am doing is plotting the course that the shots of these objects will take. To calculate the pull of the planets, I am using this formula: gravityStr/distToTarg^2 (pseudo code). Where my problem lies is in calculating the direction (an...

Why does my my gravity work in this?

http://davzy.com/gameA/ I can't figure out a smart way to get gravity. Now with this it detects which block the character is over but it does't drop to that block! Is there a better way to do gravity? I'd like to do this without a game library. ...

Android set the gravity for a TextView programmatically

I can use android:gravity="bottom|center_horizontal" in xml on a textview to get my desired results but I need to do this programmatically. My textview is inside a tablerow if that matters in a relativelayout. I have tried: LayoutParams layoutParams = new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gra...

2D orbital physics

I'm working on a 2D physics engine for a game. I have gravity and masses working, using a simple iterative approach (that I know I'll have to upgrade eventually); I can push the masses around manually and watch them move and it all works as I'd expect. Right now I'm trying to set up the game world in advance with a satellite in a simple...

Android center view in FrameLayout doesn't work

I have a FrameLayout in which I have 2 controls: - a custom view which draws a image and some text on it - a textview with a text I want to center both in the FrameLayout but I can't manage to do it. The Texview is centered just fine, my cusom view remains on the left side, when I make it visible. <FrameLayout android:id="@+id/Compass...