Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 30 Jun 2011
Offline Last Active Jun 23 2012 10:24 AM

Topics I've Started

Do you use outside tools to develop?

23 July 2011 - 06:56 PM

Currently I have made a couple smaller games using just java, no swing just Applets. (I know how to use swing in games and have made a couple. I just find swing easier). I don't quite understand why people recommend to use outside APIs to help develop games in 2D when the default APIs work just fine and can do just about everything you would want to do with the code. Maybe its because I haven't yet tried other APIs such as Slick but I am having trouble understanding why I would want to use it.

Also would you recommend to use tools available online for things such as map making and such or creating custom tools which I could tailor to the needs of my next game? Right now I'm leaning towards creating my own due to my inexperience with outside tools but I'm afraid that making custom tools might take longer then the game itself so I'm pretty hesitant about this.

Android onTouchEvent logic problems

01 July 2011 - 08:12 AM

Currently I am in the process of attempting to program my first android app. I have made several other small games in applets which all work just fine, however I am very confused by the onTouchEvent code and how it works. (And I guess the rest of Android development as well)

	public boolean onTouchEvent(MotionEvent me){
		double touchX = (double)me.getX();
		double touchY = (double)me.getY();
		double height = this.getHeight();
		double width = this.getWidth();
		if(touchY > (4 / 6 * height) && touchY < (5 / 6 * height)){
			if(touchX > 0 && touchX < width / 2){
		}			//Button 1
		if(touchY > (4 / 6 * height) && touchY < (5 / 6 * height)){
			if(touchX > width / 2 && touchX < width){
		if(touchY > (5 / 6 * height) && touchY < height){
			if(touchX > 0 && touchX < (width / 2)){
		if(touchY > (5 / 6 * height) && touchY < height){
			if(touchX > (width / 2) && touchX < width){
		return super.onTouchEvent(me);

This is my current code which handles what happens. However what is bugging me is that only gc.handlePress(3) and gc.handlePress(4) are ever called and that they are called whenever I press on their respective side of the screen, its like the height related checks aren't even looked at. Do I have some glaring flaw which I can't see in my code or is there something else which is going on preventing gc.handlePress(1) and gc.handlePress(2) from ever happening?

Thanks in advanced :D