New answers tagged

0

If the rectangle is only going to rotate 90 degrees at a time, then the simplest possible way of determining whether a ball is colliding with a black side or not is to have a rotational state of the rectangle, for example, a simple integer: int rotation_state = 0; // 0, 1, 2, 3 defines four rotational states, 0 is up Let's say a ball's spawn position ...


1

I just received an answer from the Unity Answers forum. It pointed out that I should've tried to disable the mipmaps on the sprites. After disabling them everything worked flawlessly.


0

As other already said, the sprite.Group iterator yield its members in an unordered way (like a dict, not like a a list). So if you're after a simple unordered list (not properly shuffled with a random method - if you want that follow user744's answer), just get what it gives by default. The "problem" here is quite the contrary: how to get an ordered list ...


0

As others have already said, you should probably refer to a sprite by something else then its order of addition to the group. I'll try to give some examples of uses both using a group and a regular list. sprite.Group You can iterate over sprite.Group (or sprite.Group.sprites() - both give you the same) and check each sprite against some criteria. Should ...


0

It is not that complex as you think. May be you are confusing because you have a tiled map. So the basic solution is to keep object at center (0,0) and if it has children then keep children's position (local position, position w.r.t its parent) should also be at center (0,0). Now in case of tiles you have to make sure that the whole tiled map should be ...


3

R.U.B.E. does this. The feature was included with the addition of samplers since v1.6.0. This tutorial video gives a description of how it can be done. To test, I used Anko's and Xander's images for comparison. First I imported the image of the sword and heart wand into RUBE (I'm on v1.7.0) and created some samplers (shown by dashed outlines) over them. ...


0

I recently encountered this problem 2nd time. I think it is a bug of Unity. Well, surprisingly the solution is out of the box. Solution is also like bug, silly bug silly solution. Right now your camera is definitely at Z:-10 move it to -1.... something and change Clipping Planes to Near: 0.3 Far 3. May be this exact solution may not resolve your problem, ...


9

I tried this. It was hard, but I did it. Left is GIMP, top-right is a Box2D debug renderer, bottom-right is a build shell Code repository for reference The full code is on github here. It's scattered in a whole lot of files, so it's a bit big to put here. See below for an explanation of the technique. How? I used ImageMagick, Potrace, Node.js ...


0

A good way to think about it is this. You can always break the textbox up into 9 bits, top left, top center, top right, etc. Now the corners will basically always be the same size the top and bottom side will be stretched along the x axis and the left and right sides will be stretched along the y-axis. The center will be stretched along both axis obviously. ...


0

This is a really interesting question. I think the way you could do this, using strictly box2d, would be store all the points in some kind of array, and then pop them into the polygon function. I've never used a poly myself, but judging from this: http://stackoverflow.com/questions/4360084/creating-complex-shapes-with-box2d You may be able to use the ...


3

You would need to know the angle to the element from the spectator, so, if you have A | | \aº| |bº\ | | \| | B where the lines marked with pipes "|" are the "facing" directions, the diagonal is the "attack line", aº is the angle between B sight and A (-30deg) and bº is the angle between A sight and B (-30deg). You had to add the angles to see the ...


0

I managed this stuff in love-2d: Here how i've done anim.started=false anim.curFrame=0 anim.accum = 0 function anim:update(dt) if anim.started then anim.accum = anim.accum+dt if anim.accum > anim.frameTime then anim.accum = anim.accum-anim.frameTime if anim.aType=="loop"then ...


0

As the text system is still the legacy text system, you can't embed images in text. Only option would be to have a layout group and have separate text and image blocks Alternatively, you can use an asset like TextMeshPro which has a new text implementation which supports this fully (and much more!)


0

Add a timer to keep track of your elapsed time. Take a look at the following: float Timer; const float FRAMES_PER_SECOND = 20; const float TIMER = 1 / FRAMES_PER_SECOND; void Init() { Timer = TIMER; } public void Update(GameTime gametime) { float elapsed = (float)gametime.ElapsedGameTime.TotalSeconds; Timer -= elapsed; if (Timer <= ...


-1

Here is my implementation based on the answer from S-téphan Wegener. // FOR SPRITE BASED ANIMATION: // ****************************************************** // *** right now, flickers on first cycle, but NO FLICKER after that unless animation cycle // *** restart // *** can fix later some how with creative pre-call/loads // *** for UWA/XAML Windows10 ...



Top 50 recent answers are included