Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

GameGeazer

Member Since 07 Feb 2010
Online Last Active Today, 09:51 AM
-----

#5004577 Android Game development

Posted by GameGeazer on 27 November 2012 - 11:26 AM

Don't think of this as an android specific problem. Your question isn't very clear, but if you're looking for collision detection and physics there is a nice android port of box2d.
http://code.google.com/p/androidbox2d/

As for the "rectangular bound bitmap," I'm unsure of what you're talking about. Rendering is done with Opengl ES and is pretty much the same as Opengl.
Take a look at andEngine, It'll make development alot easier if you're a novice.
http://www.andengine.org/


#4975127 Java tips

Posted by GameGeazer on 31 August 2012 - 06:51 AM

Java: How To Program (Published by DEITEL) is what I learned from.
or
Building java programs by stuart Reges and Marty Stepp

Both are very good books but can get a bit pricey(Most tech books do), find a used one on amazon. Like Rip-Off said noone will ever force all the information you need in game development down your throat(yes even in college most likely). You're young, kick the asses of everyone around you and be the best; all you need is drive.


#4933935 SDL selection based on color

Posted by GameGeazer on 22 April 2012 - 08:37 PM

Have a generic country object that either has a name or id you can use to idenify each country with. when a player clicks on the object check to see if that point is contained within the shape, if it is then select that country. Your method sounds a bit messy to say the least, I would really rethink how you're approaching the problem.


#4925221 circular gravity

Posted by GameGeazer on 25 March 2012 - 06:31 PM

Why not use the actual equation for gravity.  Posted Image,(courtesy of Wikipedia) Since F=ma you can solve for the acceleration of each object by solving for the force and then dividing by the mass of the object being moved. I wrote this code and never ended up even testing it out so there are without a doubt some trig errors and general logic mistakes but you may use this as an outline.

public void accelerateDueToGravityAtAPoint(BaseObject object1,BaseObject object2)
{
  float dist = object1.getPosition().dist(object2.getPosition());
  float force = (float) (GRAVITATIONAL_CONSTANT *((object1.getMass()+ object2.getMass()) / Math.pow(dist,2)));

  if(object1.isStatic() == false)
  {
   float angle = (float) Math.atan(
	 (object1.getPosition().y-object2.getPosition().y)/
	 (object1.getPosition().x-object2.getPosition().x));
  
   object1.setAcceleration(new Vector2(
	 (float)(force/object1.getMass()*Math.cos(angle)), //x component of the acceleration f/m
	 (float)(force/object1.getMass()*Math.sin(angle))));//y component of the acceleration f/m
  }
  if(object2.isStatic() == false)
  {
   float angle = (float) Math.atan(
	 (object2.getPosition().y-object1.getPosition().y)/
	 (object2.getPosition().x-object1.getPosition().x));
  
   object2.setAcceleration(new Vector2(
	 (float)(force/object2.getMass()*Math.cos(angle)),
	 (float)(force/object2.getMass()*Math.sin(angle))));
  }
}
final float GRAVITATIONAL_CONSTANT = 0.00012f;

If you want your objects to rotate  around their center of mass due to the force of gravity pulling them you could look at torque caused on the objects.

t =rfsin(o) // since there is no torque arm just is a constant like 1 or so for r
t = Ia  //I is rotational inetia and a is rotational acceleration
Ia = rfsin(o)
a = (rfsin(o)/I

you can calculate intertia I as either a disk or a spere if you want(google rotational inertia it isn't complicated)

Then just update the objects angular velocity basted on the angular acceleration
and update your objects angular position based on that.


PARTNERS