Quantcast
Channel: Questions in topic: "modulus"
Browsing all 37 articles
Browse latest View live

Timer For Occasional Action

I've done some searching, and have found a few examples that KIND OF touch on what I'm looking to do, but I'm getting some odd behavior. I'm looking to create a timer that will execute a block of code...

View Article



Slow down acceleration

Hello Unity Community, I have a script that has an object accelerate but my problem is that it accelerates to fast. How can I slow down the acceleration? I figured I could do something with the modulus...

View Article

Modulus with float

Im trying to do a coroutine that sets the character to hurt mode for a persiod. During this period i want it to flash. Im not familiar with modulus but i tried to use it to flip the sprite renderer...

View Article

Problem with increasing rate of prefab instantiation

I'm trying to make a game in unity in which you have to dodge rocks falling from above you. I have copied the code i have used below but the problems i am facing are that the if condition-...

View Article

Float and deltaTime problems?

I'm trying to make a rhythm game but I can't seem to get the code right. I want the ticks to show in the console every half a second but it won't show the console. Is it because there's a conflict with...

View Article


Using modulus when score climbs in odd integers.

I enable a powerup every 50 points. I would use this in previous builds: if (score %50==0 && score !=0) powerUp = true; Now I've added score multipliers so "score" no longer increases in...

View Article

C# Advertisment every so many plays

Hey guys, I'm trying to play an ad every so many new games. (My game is a play/die/retry type game). My thinking is that I can establish an incremental adding integer like this: void Start () {...

View Article

Check if a divided variable returns an integer

Hey! I want to check if a variable divided by five returns an integer. I have this: if ((i/5) == "an integer" ) Appretiate all help, thank you!

View Article


Procedural updating of Zelda-like heart images

I'm attempting to use `%` to check if the player's current health is even or odd, and update an n-dimensional array of UI images with sprites from another array. The sprite array has three indices, in...

View Article


Script's if statement dealing with time/float modulus remainder zero does not...

**Hi, I have a problem dealing with time in this line of code:** Time.timeSinceLevelLoad % levelUpBySeconds == 0f; It works perfectly if I'm in the scene with that script in empty gameObject called...

View Article

Why 2.5 % 2 = 2.5?

I don't have a lot to say about it, I'm trying to get the module between 2.5 and 2 and C# returns 2.5, instead of 0.5. The reason I'm doing that is because I have a value and I want to make it a...

View Article

How to add points when a curtain score is reached ?

I need to add point every time the player reaches a score. if the score is over 1000, give 1 point. If the score is over 3000, give 2 additional points, so it becomes 3 points in total. From what I've...

View Article

Timer For Occasional Action

I've done some searching, and have found a few examples that KIND OF touch on what I'm looking to do, but I'm getting some odd behavior. I'm looking to create a timer that will execute a block of code...

View Article


Slow down acceleration

Hello Unity Community, I have a script that has an object accelerate but my problem is that it accelerates to fast. How can I slow down the acceleration? I figured I could do something with the modulus...

View Article

Modulus with float

Im trying to do a coroutine that sets the character to hurt mode for a persiod. During this period i want it to flash. Im not familiar with modulus but i tried to use it to flip the sprite renderer...

View Article


Problem with increasing rate of prefab instantiation

I'm trying to make a game in unity in which you have to dodge rocks falling from above you. I have copied the code i have used below but the problems i am facing are that the if condition-...

View Article

Float and deltaTime problems?

I'm trying to make a rhythm game but I can't seem to get the code right. I want the ticks to show in the console every half a second but it won't show the console. Is it because there's a conflict with...

View Article


Using modulus when score climbs in odd integers.

I enable a powerup every 50 points. I would use this in previous builds: if (score %50==0 && score !=0) powerUp = true; Now I've added score multipliers so "score" no longer increases in...

View Article

C# Advertisment every so many plays

Hey guys, I'm trying to play an ad every so many new games. (My game is a play/die/retry type game). My thinking is that I can establish an incremental adding integer like this: void Start () {...

View Article

Check if a divided variable returns an integer

Hey! I want to check if a variable divided by five returns an integer. I have this: if ((i/5) == "an integer" ) Appretiate all help, thank you!

View Article
Browsing all 37 articles
Browse latest View live


Latest Images