Tag Info

New answers tagged

0

First off, I would store paths as an array of points/vectors/ whatever they call it in the framework you're using. It's a coordinate, using x and y variables. When the player builds a path, you know the x and y coordinates of that point (let's call them points). For all your path arrays, check if it contains one of the 8 adjecant points (same x, but y+1, ...


0

Rotation matricies Derived from Euler's Formula: e^ix = isin(x) + cos(x)


0

The way that I did it was by taking the player's x co-ord and y co-ord, made them negative and added them to screen width/height divided by two FactoryWU.frame.GP.cam.locationX = (int) (-FactoryWU.world.player.getXInt()+((this.getWidth()/cam.zoomLevel)/2)-(10*cam.zoomLevel)); FactoryWU.frame.GP.cam.locationY = (int) ...


0

if yow saw this pop up while you start to run your code just click your main class which contains your main method


0

Oh! i got solution by myself... I did the same thing as i mentioned in first comment my question where I attached balls on a big circle body like, Body circleBody ... ;// having large radius //for all balls arranged in hexagon structure foreach BallBody b { WeldJointDef def = new WeldJointDef(); def.initialize(b, circleBody, b.getWorldCenter()); ...


0

http://www.rodedev.com/tutorials/gamephysics/ float jumpHeight = 4; //defining the jump height isn't needed. You need only determine the y velocity versus gravity. I suppose that jumpHeight could be the y velocity. You can use trigonometry to determine the jump velocity at a specific angel as shown on the link I provided. Grant you this isn't exactly in xna ...


0

You only truly need a separate class if you're multithreading, so you can have separate constructors, one ran in the render thread. Even then its up to you whether or not you want to do that. The big reason is just organization. More important than anything is to make sure your textures and render programs are static. You also want to render all of a single ...


0

Unless it is a personal use, which means if you go public free or not, you cannot use the exact, recreated or apparently imitated designs without permission. For parody and fan uses, every company reacts totally different. Some are totally ok with most fan art, some took it very seriously against it and take immediate legal action for any public use. There ...


1

If the circles never need to move independently, you can make one body. See here for an example of a hexagon body. I've extracted the relavent bits and pasted them here: import static org.anddev.andengine.extension.physics.box2d.util.constants.PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT; import com.badlogic.gdx.math.Vector2; import ...


1

I suggest moving the target slowly rather than the angle. Try this: Vector2 Target; // Interp is a value between 0 and 1. When 0, the target never moves. // When 1, the target moves instantaneously. Intermediate values cause the target // to move at different rates. void UpdateTarget(float interp) { Target = interp * Mouse.Position + (1 - interp) * ...


1

I think any linear function would be fine for this. You can keep two variables one for your spaceship's current angle spaceshipAngle = Math.PI*k, and one for the current angle that the user inputs with his cursor cursorAngle = Math.PI*p. And what you do is if (Math.Abs(Math.PI*k, Math.PI*p) < Math.PI) { if (Math.PI*k < Math.PI*p) k += ...


0

The best way, and simplest way would be to work with Unity's particle system. Have a quick Google for unity water particles. OF the water is sprite based, create a sprite for this water splash instead. On collision with your paddle or boat, instantiate said prefab at that position.


0

If you've made sprites at a low resolution, they become smaller when you change to a higher resolution. To counteract this, scale your sprite at runtime. Just bear in mind: if you do this, you won't see a difference between the high and low resolution, because you're simply scaling a low resolution sprite. This is only useful if you want to adapt to 16:9 ...


1

It's been a few years since this question was posted, but I came across it while searching, so I thought I'd update it. Google released LiquidFun (open source) for the Box2D system. It has some limitations, but it's a quick way to get started with liquid, sand, etc particles with pretty decent performance. https://github.com/google/liquidfun PixelJunk has ...


0

I think you have inverted the alpha in the interpolation. It should be curr*alpha + prev*(1-alpha). From Fix Your Timestep!: State state = currentState * alpha + previousState * ( 1.0 - alpha ); In fact you are rendering an interpolated status that has 1 time-step of latency, so Actual time elapsed |----------|---_______| Time simulated ...


2

When you don't want any problems with anybody, don't copy other peoples intellectual properties. Even when you assume you are technically in the right (fair use, notable differences and all), they might still sue. In most parts of the world, civil lawsuits aren't like criminal lawsuits. You won't get an attorney for free and defending yourself as a ...


2

What you want is a skew matrix. XNA has no built-in mechanism for creating one. Fortunately we can write our own: Matrix CreateSkewX(float angle) { Matrix skew = Matrix.Identity; skew.M12 = (float)Math.Tan((double)angle); return skew; } Matrix CreateSkewY(float angle) { Matrix skew = Matrix.Identity; skew.M21 = ...


-1

If you really need to skew image you can write your shader for it. It's got solution if when you need deform image in any non-standard way.


0

You could draw it in 3d. Actually rotate it around the "up" axis. What's actually quite ironic though, is that you're already showing how it could also be done: You could split your sprite in strips vertically, drawing them at a small y offset from eachother. Note however that this skews the sprite, rather than actually rotating it. Not knowing if that's ...


0

I've had some trouble with this myself. I've never actually found a perfect way to do it, but a* pathfinding with Jump point search should make it possible. Take a look at this: http://gamedevelopment.tutsplus.com/tutorials/how-to-speed-up-a-pathfinding-with-the-jump-point-search-algorithm--gamedev-5818


0

In most cases, doing what you propose will be less efficient than rendering the maps as individual tiles. The tiled approach gets more efficient the more tiles are repeated, and provided that the tiles aren't too small. With Phaser, the Tiled format is well supported, so you can follow this workflow: Create a tile map using Tiled Export to JSON Load the ...


0

I would reccomend removing your box collider and then add it back again. It will automatically resize to fit your texture. It looks like it is a bit off to me. The ground detection looks fine, but both the corner circle colliders are too low. This will cause unrealistic looking collision detection, unless you have reasons for the collider offsets.


0

I would add a slippery physics material then adjust the friction to fit your game. It should fix any hang ups.


0

You can try adding impulse type force in random direction right after they are instantiated.(I'm assuming they are rigidbodies)


1

It might be worth a shot to create a particle system that solves your problem. I believe there is a collider box that could be used to re-collect the coin after they shot out


0

I'd wager it's related to you using this "DrawX" value for only one of the rect coordinates. I don't know Unity, but I'd wager that it at least needs to be applied to one other corner of the rect (the other X).


0

normalize your normal vector n before using in in the reflect formula. Vector2 n = hit.normal; n.Normalize();


4

Unity has a great Random property called UnityEngine.Random.insideUnitCircle that will pick a random vector inside the unit circle. It great to assign both position around the spawn point and a random direction they can go in. An example of a basic trajectory code: void Start() { trajectory = UnityEngine.Random.insideUnitCircle * velocity; } void ...


0

I would add a bool for isCollected; so if(isCollected) token++ you want the coin to be inside a empty gameobject so when you go to animate it you are animating the child so it doesn't move all the coins to the position of where you created the first.


0

Solved! http://docs.unity3d.com/ScriptReference/Sprite.Create.html I should've used proper Sprite factory method and passed pixel to units: Sprite.Create (texture, new Rect (x, texture.height - y, tileset.tilewidth, tileset.tileheight), new Vector2 (0.5f, 0.5f), 128)


0

In addition to having a ridgidbody (one must be present for OnTriggerStay to be called at all), you may also want to try different 'collision detection mode' types on that rigidbody. If the ball is moving too fast the default 'discrete' might not be accurate enough to see the ball whizzing by, and if the ball is going too fast then the 'Continues Dynamic' ...


0

You need a rigidbody connected to at least one of the objects with a collider (as @Savlon mentioned), but the other issue with gravity can be alleviated by toggling the rigidbody's Kinematic attribute.


0

What you need is the vector of the shortest distance between the Wall and the balls center. More generally, you seek the distance between a point and a line. Paul Bourke has given a general solution to this well known geometry Problem on his website: This note describes the technique and gives the solution to finding the shortest distance from a point ...


5

Sarting with the clouds, a simple method is to draw them as three layers: Layer 1 is the bottom layer, and is drawn first. It just contains the cyan background. Layer 2 is the middle layer, drawn between the other two, and it represents the 3D highlights. The background in this layer would again be transparent (represented by a purple colour in the ...


3

You could achieve this effect using parallax scrolling by making the earth and each shade of green a separate layer. With a parallax effect, no 3D calculations are required, and you get to stay with the pixelated, simple color style you're using. Note that parallax doesn't have to be limited to just horizontal motion. Vertical movement (when the camera ...


0

You can add a depth component to your 2D textures and set the depth value in the pixel shader. There will be some performance loss due to setting the depth in the pixel shader but shouldn't matter for a 2D game on PC. The other way is to use multiple layers of 2D textures for your background.


1

If You subdivide the line into CE and ED and the projection of the 2 lines combined will be the projection of the full line. Using that we split the line where it intersects the screen then EC' will be the resulting line and you ignore the ED part of the line. Current day graphics pipelines will do this automatically using frustum culling with the near ...


1

What you are looking for is called ribbon trail. While a particle trail does the job as well there are a few problems with using particles: missing particles at high speed gpu overdraw effect limited to particle settings However if this effect fits your game better then here is a good tutorial: World of Goo Cursor This porblems were the reason i ...


1

You need to change the collision of a ball against an infinitely thin line to an infinitely small point (ray) against a thick segment with two round ends You transfer the ball's thickness to the segment. Both end points become circles. The collision then becomes a 2D ray-cast operation.


2

That spacing is called font kerning. And that is exactly why there is padding in front. The purpose of kerning is so that letters fit nicely next to each other, and that they aren't too close or too far away from each other.


0

I strongly recommend Haxe + OpenFL. Haxe is a language based on ActionScript. There are a few differences but its the closest to what you know. The language manual and API reference at http://haxe.org are great resources. OpenFL is the Haxe implementation of the Flash API, you can find info on OpenFL at http://openfl.org (this is the best place to start, ...


4

You could use polygons, or you could do a quick and dirty hack and just get a political map like this one: . Then, pick a unique color for each country and flood fill it in paint or photoshop. Then, you have a simple file that just has the mapping of countries/provinces to particular colors. Just something like this: # Country, #Unique RGB color ...


1

It is pretty complicated stuff going on and its not that simple as it look bcs of the way of opengl buffering system works.The best way to do it is just draw 3d and then 2d. You might create some kind of ArrayList which will keep track of all 2d drawing requests. And when 3d is done you execute them all.


0

You want to actually assign a new value to Player.transform.localScale then, not just change the local variables playerScaleX and playerScaleY. Vector3 playerScale = Player.transform.localScale; playerScale.x += scaleUp; playerScale.y += scaleUp; Player.transform.localScale = playerScale; or, it you really want to use the existing variables playerScaleX ...


1

Instead of using Mathf.Atan(y / x), which can only return angles between [-90..90] degrees, then compensating for angles outside that range by adding 180 degrees, simply use Mathf.Atan2(y, x). Atan2 is specifically made for the task you are solving. From the Mathf.Atan2 docs: public static float Atan2(float y, float x); Returns the angle in radians ...


0

You just need the angle of collision? How about: Vector2 collisionAngleVectorToFirstEntity (secondEntityPosition.x - firstEntityPosition.x, secondEntityPosition.y - firstEntityPosition.y); I'm not familiar with Unity but that Vector is pointing from the second point to the first point so running that on collision gives you a angle although in the form ...


0

Here is my java implementation to get the closest one from a quadTree. It deals with the problem dlras2 is describing: I think the operation is really efficient. It is based on the distance to a quad to avoid searching in quads further way then the current closest. // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...


2

This animation is likely a bunch of different colored sprites moving or fading in to follow the path of the trail. Look up particle systems. They let you control many sprites/objects at once easily with a set of rules to define their movement. For this example, you can start with a white circle moving in pre-defined path. Using trigonometric functions is a ...


0

My meshes were being generated correctly. However they were not rendering to the camera. I had to change the mesh's scale's z value to any value less than 0f for it to render. I am closing this question and opening another to figure out why exactly this is.


0

I dont know how raycast is implemented in Unity but it could very well be as you suspected, the raycast will not hit objects with same x, y or z. Imagine if you are implementing an overlap function that checks if (a,b) overlaps with (c,d), whether (1,2) overlaps with (2,3) is dependent on how you implements it.



Top 50 recent answers are included