Tag Info

Hot answers tagged

3

This should do the trick. Split coords using "whitespace" Foreach resulting array Split the pairs to x y Parse strings to int Create point Add to list String coords = "0,0 0,1 5,2 7,4 10,5" String coordsArray[] = coords.split("\\s+") // Results "0,0","0,1","5,2","7,4","10,5" List<Point> points = new ArrayList<Point>(); for(String s : ...


2

You have to return true from touchDown. Documentation says: The GestureListener can signal whether it consumed the event or wants it to be passed on to the next InputProcessor by returning either true or false respectively from its methods. So, if you return false from touchDown, that is the first even raised in all cases, it stops event handling. If ...


1

//At the apex of the jump, Ruben's velocity.y is ~0 if (Math.abs(ruben.velocity.y) < 1) //If Ruben's velocity.y gets close to 0... { ruben.velocity.y = 0; //stop him Ruben.setState(Ruben.RUBEN_STATE_IDLE); } //velocity.y = +1 //jumping //velocity.y = 0 //no more jump left; begin falling (except the if activates) //velocity.y = -1 //falling Edit - ...


1

Do some manual tracing to determine where in the water the ship is... it could be as simple as checking the Y or Z coordinate being below 0 if your world is all water with the water table at level 0. Anyway, if the ship is in water, every timestep, push it upward with a force/impulse. The deeper in the water it is, the stronger the push. This should work ...


1

In Bob's update method you do nothing with his velocity. He has no way of actually moving, with the code you have shown. You should do something along the lines of this before you reset the bounds: position.add(velocity.x * deltaTime, velocity.y * deltaTime);


1

In LibGDX Doc Gdx.gl.glClearColor(0, 0, 0, 1); and batch.setProjectionMatrix(camera.combined); is setting in render() method at a time. I use this definitions in create() method at once, and it is running perfect. So why should i use this definitions in render() method? is't it a performance loss? The clear color is part of your OpenGL ...



Only top voted, non community-wiki answers of a minimum length are eligible