Questions tagged [mathematics]

Mathematics questions deal with the arithmetic, geometry, calculus, formulae and other calculations used in the development of a game.

Filter by
Sorted by
Tagged with
-1
votes
2answers
194 views

Velocity deacceleration working incorrectly

Basicly, I've tried to code velocity into my game, which works sort of. The deaccelaration works sort of, but not correctly. The problem is, that the positive values, decreases just fine and dandy to ...
-1
votes
1answer
1k views

How do I convert sin, cos and tan into an int in Java?

How would you be able to change Math.sin, Math.cos and Math.tan into an ...
-1
votes
2answers
1k views

Shooting many bullets toward the mouse position

I try to shoot a bullet toward the mouse position by this code. ...
-1
votes
1answer
216 views

In a regular grid, how can I tell which tile a position is in?

I have a position on the screen, how do I calculate which grid tile that position is inside? I know the number of tiles in the grid, and the size of the screen (including how many tiles fit on it ...
-1
votes
1answer
210 views

Camera not working

I made a camera in DX9. To move forward I press the Up arrow. To rotate on the Y axis I use the mouse. When I perform these movements on their own the camera moves at the speed I want. However, if I ...
-1
votes
1answer
644 views

Perlin Noise' gradient

I'm having some problem understanding the Perlin Noise algorithm and none of the explanation I found go into this (probably obvious)detail. From what function is the gradient on it? Is it from the ...
-1
votes
2answers
101 views

Center of Image whose height, width and position are known

I have been struggling to find the center of an image(rectangle). I have following data with me: width: w, height: h, position: (x,y) My image is an object on ...
-1
votes
2answers
234 views

How to make sure that a Point A moving in the direction V reaches at Point B?

Let say I have, Point A(X1,Y1) moving in the direction V(W, H). I need to make sure that it reaches B(X2,Y2). I think I need to subtract some value in Point A(X1, X2). But not know what? I also sure ...
-1
votes
1answer
120 views

What happens if first we scale a rotation matrix and then multiply it with an object?

This question has been bothering me lately. I know the correct order to scale, rotate and transform a matrix but the question I have is very different. What if we first scale our rotation matrix by ...
-1
votes
1answer
63 views

Increase event trigger chance the closer two numbers are

I have two numbers, one steadily increasing, the other is fixed. I'm trying to increase the likelihood of triggering an event as the increasing number gets closer to and surpasses the fixed number. ...
-1
votes
2answers
605 views

Generating hidden box collider between two game objects in unity

I'm trying to implement flappy bird clone using unity. I'm creating two obstacles at random y position. I would like to create a hidden box collider game object between them, but I'm struggling with ...
-1
votes
1answer
129 views

Simulating aircraft movement with DirectX 9 [closed]

How would I go about simulating a planes movement in DirectX 9 using transforms (i.e. matrices). For example flying around an open space. When it moves it faces the direction it is going and ...
-1
votes
1answer
42 views

Centering three rectangles of different size

If I have 3 different sprites, that each belongs to the same sprite but with different animations type. Each has a different width, height, in the sprite sheet. How do I adjust the 3 using math, to ...
-1
votes
1answer
67 views

Good way to integrate time to a quiz game [closed]

I wasn't sure which stack exchange site to pose this question to, so I'm asking it here, I hope it's appropriate. This thing I'm writing for fun is basically a mental math speed quiz game. I'm writing ...
-1
votes
1answer
1k views

how to predict enemy postion to shoot bullet same kingdom rush

i'm doing a tower defense game same kingdom rush, enemy can run curve not only linearly. i found this link : 2D tower defense - A bullet to an enemy but this link use only for enemy run linearly. ...
-1
votes
3answers
444 views

Directional light and matrix issues

I'm trying to implement basic directional lightning in OpenGL 3.3 by emulating the logic shown in this guide: http://www.arcsynthesis.org/gltut/Illumination/Tutorial%2009.html I do not understand ...
-1
votes
2answers
332 views

What kind of math should I be expecting in advanced programming? [duplicate]

Possible Duplicate: What math should all game programmers know? And I don't mean just space shooters and such, because in non-3D environments it's obvious that not much beyond elementary math is ...
-1
votes
1answer
165 views

How to calculate speed of a moving object in unity

Currently I am trying to calculate the speed of an object here is the below code snippet: ...
-1
votes
1answer
184 views

Exp equation for enemy and player in rpg

I am making an rpg game with specific leveling system I want when a level 1 player fights a level 25 monster to level up to level 20-25 then when he goes and fight the same monster he then levels ...
-1
votes
1answer
227 views

XY rotation directions

I have a simple WASD controller to rotate the player, but if I press W and the player has been rotated by 20 degrees, it will only rotate around the x axis. Yes, it's logical, but how I should I ...
-1
votes
1answer
849 views

libgdx - Math for wall collision when adding velocity

I've created a game which spawns a random colored ball in the top or bottom of the screen and moves to random direction with this method. ...
-1
votes
1answer
440 views

Example formula for current level from total EXP?

This question may already have been asked, but, nonetheless, what would an example formula be for getting the current level from the total amount of EXP a player has? As in the variable that's known ...
-1
votes
2answers
188 views

What's the difference between the representation of a line and that of a line segment?

What is the difference between a line and a line segment from the implementation point of view? To me, line segment means: ...
-1
votes
1answer
103 views

Perspective projection? [closed]

I am trying to write an elite like game and I kind of understand the maths behind it but it would be really helpful if someone could explain it.
-1
votes
1answer
473 views

lerp z rotation towards mousepointer

I am trying to get transform.rotation.z to chase the mouse pointer at a rotation speed. But I get a very weird results and can't figure out what I am doing wrong. ...
-1
votes
1answer
301 views

Animating values using splines

I'm trying to create a system similar to Blender's f-curves or Unity's animation curves (google it, I'm not allowed to post more than two links yet). It's basically a 2D spline where time is on the X-...
-1
votes
1answer
322 views

Trouble figuring out some attack/defense formulas. What should I change? [duplicate]

I'm working on something which requires a hunter to attack an animal. This is what I have so far. Attacker/Weapon POV Level - 1 to 50 Base - base attack level of the weapon Weapon Impact - ...
-1
votes
1answer
231 views

Smooth Ramp to zonal harmonics

I have written in blitz3D some code to generate arbitrary 2D lighting lookup textures and I'm looking for a way to compress them. The idea is that they look rather smooth and low frequency, there must ...
-1
votes
2answers
199 views

adding space between each bricks in breakOut [closed]

i am trying to create breakout. code below loop though my 2d array(map) and creates bricks. the problem is that i want to add 10 pixels space between each bricks. i was thinking to add x*titleWidth+x+...
-1
votes
1answer
336 views

How to implement cue-stick animation for a pool game?

Hello I am developing a Pool game, and I've been scratching my head about what formula is needed to implement an animation for the cue stick. The animation of the cue stick should look as if it's ...
-1
votes
1answer
647 views

Is it legal to use formulas from a professional game?

The Pokémon series uses a total of 5 different formulas to determine how much experience is required to get to the next level. Likewise, in RPG games, each character has a formula for determining when ...
-1
votes
3answers
1k views

Shooting based off mouse position [duplicate]

I'm trying to shoot bullets where the mouse is aiming using one image as a test. I'm trying to get the mechanics like this I have some kind of algorithm to handle that but the results arn't too good....
-2
votes
2answers
135 views

Converting a table into a formula / equation

I need help to figure out the formula / equation or at least the growth rate based on this table. All I can see is that the base stat is 12 as STAT2 = 2 x base and STAT3 = 5 x base.
-2
votes
2answers
6k views

Get Angle with respect to 360 degree

I have fixed object, around its an object is moving in circular shape. Now i am willing to get my moving object angle with respect to fixed boject like form 0 to 360. How can i do this. i tried this ...
-2
votes
2answers
10k views

Convert atan2 value to standard 360-degree-system value [duplicate]

Lets say I'm using atan2 to get the angle between two vectors. atan2 gives a value in radians. I convert it to degrees using a ...
-2
votes
1answer
97 views

Calculate experience for each kill [closed]

I need a formula to calculate experience of players on each kill. It's based on the value of armor of the 2 opponents. For example if i kill the opponent and i've a total armor of 4000 gold and the ...
-2
votes
1answer
1k views

Lerp speed or lerp time [closed]

Am I right about the fact that lerping can be done over a set period of time or at a speed which will continue until the target is reached? How are the formulas for the two? Is it something like ...
-2
votes
1answer
754 views

How to determine a "Hit\miss" system?

I always try to fix my problems on my own, but i've reached a point where my mind is stuck so i trust myself in your hands, if you're willing to help and have the time. I'm starting to make a RPG ...
-2
votes
1answer
337 views

Move projectile in direction the gun is facing [duplicate]

Possible Duplicate: Move sprite in the direction it is facing? I am attempting to have a projectile follow the direction a gun is facing. When using the following code I am unable to make the ...
-3
votes
1answer
878 views

Getting the normals of a hemisphere?

I'm trying to calculate the normal for a hemisphere. I draw the hemi-sphere by this code: ...
-3
votes
2answers
303 views

Calculating AABB's Origin

I can't work out how to find the position in which my AABB should be corresponding to my object.
-3
votes
1answer
84 views

How perform for obj follow mouse with angle?

how i can perform for sprite follow mouse if i change angle ? If i change angle the sprite no more follow mouse correctly. I absolutely need the obj follow mouse with pivot. https://jsfiddle.net/...
-3
votes
1answer
91 views

Translate Object position into Time

I have a cube which i am moving in circle shape (with horizontal key input) is below code suggested. ...
-4
votes
3answers
245 views

Get bullet movement direction?

I have two objects, A and B, at two different points. I want B to fire at A. B's shot moves so far x and y every frame. How do I get the angle it needs to travel at as two numbers, one representing ...
-4
votes
2answers
486 views

How to find damage per second using Average Damage, Accuracy and Fire Rate Per Second? [closed]

I was wondering if anyone could help me establish a DPS equation using the variables 'Average Damage', 'Accuracy (%)', and 'Fire Rate Per Second'. Here is my table: Note: These numbers are examples ...
-4
votes
2answers
139 views

What effect does the amount of 0 in a stat have. [closed]

Basically I want to know if the following three characters are the same character A health 10 strength 3 defence 2 character B health 100 strength 30 defence 20 character C health 1000 ...
-5
votes
2answers
120 views

Should I negate a variable or use absolute value? [closed]

this is how i was chaning ball postion if(...) //if ball goes to left of screen dx = -dx if(...) //if ball goes right of screen dx = -dx; i found some people ...
-5
votes
3answers
2k views

How can I find a point on a line when I have only two other points?

I have a straight line passing from points A(2,-1) and B(4,5). I want to find a point C that is on the line and outside A-B.

1
33 34 35 36
37