Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

can somebody help

$
0
0
im coding a weapon script to control stuff like ammo amount,reloading and other things but im getting this error Assets/scripts/weapon.cs(8,26): error CS0031: Constant value `1' cannot be converted to a `int' here is the code what is causing this using UnityEngine; using System.Collections; public class weapon : MonoBehaviour { public int rounds = 17; public int curentrounds = 17; public int animspeed = 1.0; public GameObject gun; public AnimationClip fire; public AnimationClip reload; // Use this for initialization void Start () { animspeed = AnimationState.speed = animspeed; } // Update is called once per frame void Update () { if (Input.GetMouseButtonDown(0)) { animation.Play (fire); curentrounds -=1; if (curentrounds <= 0) ; animation.Play (reload); animspeed = 0.5f; } else { if (Input.GetKeyDown(KeyCode.R)) animation.Play (reload); animspeed = 1f; } } } a little info i wanted to punish the player for not reloading when they had low ammo,so if they let the gun dry fire it will slow the reloading animation thank you for your time and effort in advance

Viewing all articles
Browse latest Browse all 7934


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>