Tag Info

Hot answers tagged

5

Start by adding a variable for the angle that the car is moving at. float angle = Math.Pi / 2; Then add a variable for the current speed. float speed = 0.0; Now create three constants: public static final float acceleration = 0.1; public static final float maxSpeed = 5.0; public static final float rotationRate = Math.Pi / 50; For starters, get your ...


2

The BSP method is apparently the most popular method for generating dungeons, but it's not the only one. For completeness I'll explain the generator that worked for me. I have to admit that I don't recall where I read about this so I'll just say that it's not my invention. A maze with rooms The basic idea is that a dungeon is a maze with rooms, sort of. ...


2

You may do what you need in 2 step: Clustering: First you can cluster your point. There are many clustering algorithms which will put your points into multiple close-distance group. K-means is one of your options. Convex Hull: Then you can create Convex Hull for each cluster. such as: Gift wrapping algorithm, Quick Hull, Bridge, ... There is a trade-off ...


2

You could just store a second image (or use the alpha channel of your image) to store a heat map (this also depends a bit on how you're drawing this, e.g. through a canvas). You just create some mapping and tint areas in their specific color (example): Left arm becomes red. Right arm becomes orange. Left leg becomes cyan. Right leg becomes blue. As an ...


2

If you write a 1 for a connection and 0 for lack of connection, and have 8 sides, then you can write out the configuration of an octagon as a bit string. I'll order them as east, northeast, north, northwest, west, southwest, south, southeast. If north and west are connected to neighbors and other directions are not, this would be written 0 0 1 0 1 0 0 0. ...


1

Unless you want to allow octagons to overlap (when you would, you would be in quite a lot more trouble), it is impossible for two adjacent edges (a diagonal and an orthogonal) to be both connected to another tile. This makes stuff a lot easier. Separate each of your octagons into 9 tiles like this: You need one set of tiles where the diagonals are ...


1

First use Zehelvion answer to make the car turn correctly, then: Use the timestamp, you measure how much time it took for your last iteration and use that to modulate the speed at which you are changing things. void RunGame(float deltatime) { if (key.KeyCode == Keys.Up) { Player1.speed += accelaration * deltatime Player1.speed = ...


1

If you look at a circle with the angles marked you will see that 270 degrees corresponds with (0,-1) i.e. straight down. By convention degrees are marked as acceding in a counter-clockwise direction. They do however form a loop and as such 270 degrees (purple arrow) can also be expressed as -90 degrees (orange arrow) i.e. a quarter turn in the opposite ...


1

The best way to get around these types of limitations is to move the world, rather than move the player and camera. Strict Method Keep your camera and player at (0,0) if you're using 2D or (0,0,0) is you're using 3D. When you calculate the input to move your player, instead of moving them, move all the objects in the environment. When the objects get some ...


1

My solution would me to create 2 identical objects that are spaced apart by the width of the screen.So when the first object is in the middle of the view (for example left one), the other object would be screen width apart from the first object i.e. off the view. When you move the first object the second one moves along with that object, keeping the space ...


1

I imagine it's because you're only passing the iterators i, j, k to SetCell which will limit cell placement to 60 along all three axes, creating the outline of a cube.


1

Short answer: probably not. Look here https://hg.libsdl.org/SDL/file/704a0bfecf75/src/render to see that there are implementations of generating real textures. It depends on devices you are targetting. When current texture is being changed you call it a change of context on graphics card. It may work worse on mobile phones to often change texture, ...


1

Just like Raxvan said, generally a single large texture is the optimal way, but that does not mean you have to choose between either, at least as far as your assets go - it's not extremely difficult to write a texture packer that takes a number of images, and packs them into one or more larger textures, with a by-name or by-index lookup. Depending on how ...



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