Hot answers tagged

6

It shouldn't have any impact. You should not be implementing zoom by scaling or otherwise messing with 'the Z factor' (whatever that is) of your objects in the world. You should be implementing zoom by adjusting properties of the camera and projection (field of view, camera position). The camera and projection properties only come into play when you ...


2

Touchscreen devices do not have keys, so you need to think about another input method. A quick and dirty solution to adapt a game designed to be controlled with directional keys to a touch device is to use a "virtual keypad". Use the Unity UI system to create four buttons on the screen the player can tab on, and bind each to an appropriate function which ...


2

It could be that the attack timer never reaches 0 as the delta time will keep removing time which will eventually cause it to go negative. Instead check if the timer is less then or equal to 0 so if it goes negative the attack animation is stopped. else if (attackTimer <= 0f) Note: You should add an "f" behind numbers that you want to be floats because ...


1

If I understand your question correctly this can be done using a bit of vector math. I've created an example in Javascript so please keep in mind that many of the mathematical operations I'm doing here can be done in Unity really easily using the built-in classes and methods. The ball will follow your mouse when you hover it over the window. I recommend you ...


1

The algorithm you are using right now has a runtime of O( n^2 ). A tree structures can help you get that runtime lowered. Quadtrees have O( log(n) ) From that you can calculate if you will benefit from a quadtree.


1

The animations and logic for attacks can be broken down into individual logical units and then sequenced via data files. For example, you might have code like this: AdvanceBehavior(entity, target, speed) FallbackBehavior(entity, target, speed) SoundBehavior(entity, sound_id) AnimateBehavior(entity, anim_id, speed) and then you can have a data file that ...


1

Should I have a base class for the battler which has all the common methods and than inherent each character from that class with its own attack sequences? If you have a lot of battler types, I don't think you would necessarily want them all to be their separate class if they are very similar to each other otherwise. One approach would be to have them all ...


1

Your image is 64x64 and your Pixels To Units setting is 100. That means at native size your Sprite is 64/100 = 0.64 units wide. To make this 3 units wide, you'd need to set your local scale to 3/0.64 = 4.6875 Or, you can change your Pixels to Units setting to 64, then your sprite will come in at exactly 1x1 unit, and a local scale of 3 will make it 3 ...


1

The problem is in your game loop You are limiting your rendering fps to your game world fps. You should update your world on a fixed timestep and either leave the render timestep to vsync or limit to something like 60.. You're using non floating point variable types where you should be using floating point math. This adds imprecision and can cause ...


1

Unfortunately, I don't have enough reputation to add a comment to your original post. Here is my go at a partial answer! Here is where you populate the top row with 30 white boxes. for (int i = 30 - 1; i != -1; i--) { hitbox[i][0] = 1; } It looks like your boxes are 20x20 because tmp[0].position = Vector2f(y * 20 - 10, x * 20 - 10); My honest ...


1

In Alto's Adventure, the terrain is dynamically generated over time, by concatenating prefabricated patterns (for example the super steep slope where you can perform a triple backflip, or any other soft slopes) in a randomic way to keep the game various from play to play. A possible implementation can be treating these "pieces" of terrain as vertices, from ...


1

Unfortunately this is quick to answer: You can't from a single image. To determine the intrinsic camera parameters (like lens distortion) you'll need at least a few pictures and more known points. If you want to read more about it, Google for "camera calibration" or lookup how some libraries do that, e.g. OpenCV. From a single image all you could get are ...



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