Tag Info

Hot answers tagged

2

Just rotate the point at an angle of -θ around the center of the rectangle. relx = x-cx rely = y-cy rotx = relx*cos(-theta) - rely*sin(-theta) roty = relx*sin(-theta) + rely*cos(-theta) dx = max(abs(rotx) - width / 2, 0); dy = max(abs(roty) - height / 2, 0); return dx * dx + dy * dy; Also, remember this is still the distance squared, so you need to take ...


2

All of the atlas regions are automatically available through the skin as TextureRegions. I just tried it, and works without modifying the json file. You can just call skin.get(name, TextureRegion.class); or skin.getRegion(name); Unfortunately, the skin docs are not very clear about this. libGdx docs


2

Before addressing the specifics of your question, I do want to point out that I disagree with your approach to your inheritance model. A Game generally does not implement a Scene but instead a Game consists of one or more active Scenes that are being rendered and updated in a main loop. It's important to think about whether a class relationship can be ...


2

why not create a list of enemies in the level so the draw becomes: List<GenericEnemy> enemies;//filled during construction Render(){ //Render elements common to all levels draw(background); draw(playerSprite); for(GenericEnemy enemy : enemies) { draw(enemy); } } where GenericEnemy is a superclass of all enemy ...


2

It's not that object oriented paradigms are bad for game development, they do the job just fine. Though, there are downsides to doing everything with a typical OOP mindset. 1) Inflexible, you can't reassemble behaviors and properties of your game objects on runtime as they are tied to fixed class hierarchies. 2) Slower unless you mix OOP with data ...


1

You have your thisMin and thisMax declarations reversed. Vector3f thisMin = new Vector3f(this.pos.x + this.w, this.pos.y + this.h, this.pos.z + this.d); Vector3f thisMax = new Vector3f(this.pos.x, this.pos.y, this.pos.z); should be: Vector3f thisMin = new Vector3f(this.pos.x, this.pos.y, this.pos.z); Vector3f thisMax = new Vector3f(this.pos.x + this.w, ...



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