Tag Info

Hot answers tagged

1

Procedural maybe the fastest way in CPU speed terms, but would be also the worst to work with. Games in AI and Physics have a lot of code, and controlling such things with a ton of function calls can be very frustrating to maintain the code for later use and reuse. Functional is the the most slow in CPU speed terms, and you should totally avoid these in 3D ...


1

You're monster locations are based on a random number: monster.setPositionXY((r.nextInt((int) width)), (r.nextInt((int) height))); You initialize width and height with: width = Gdx.graphics.getWidth(); height = Gdx.graphics.getHeight(); So your monsters will be placed on a random location in screen coordinates. Now I'm not sure about your drawing code ...


1

Don't directly translate the object in response to key presses. Instead, increase the speed in response to key presses, and then translate the object's position using that speed. That way the speed changes every frame. pseudocode: float speed = 0f; float maxSpeed = 20f; float accel = .2f; void Update() { if (Input.GetKey(KeyCode.I)) { speed += accel; ...



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