palidzat ar vien sik skript kam nav slinkums c#

Vēlies radīt spēli, bet nezini ar ko sākt? Sperot pirmos soļus, vari meklēt padomu šeit
Post Reply
Message
Author
Digital
Posts: 5
Joined: 16 Sep 2017, 04:27

palidzat ar vien sik skript kam nav slinkums c#

#1 Post by Digital » 21 Sep 2017, 03:41

ja kaddam nav slinkums palidzat ar unity skriptu ..tas ir vienigais ko man vaig ..pectam es vinu uz visam kermena daljam spamoshu ..atradu neta re ku links kur atradu http://answers.unity3d.com/questions/47 ... ation.html
man vaig tieshi to funkciju ..spiezham pogu animacija spele ..atlaizham apstajas ..spiezham citu pogu animacija spele reversaa

esmu pilnigs nuubs bet man tas ir vienigais kas kave no speles izstrades
re ku tas ko es sacepu .. un sameta 1001 erroru (10 errorus ja precizak)

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class test : MonoBehaviour {

	public Animator anim;

	var LEFTKNEE:Transform;
	var Bend1:AnimationState;

	var B1A:boolean = false;
	var B1B:boolean = false;

	// Use this for initialization
	void Start () 
	{
		anim = GetComponent<Animator> ();
	}

	{
		Bend1 = LEFTKNEE.animation["LEFTKNEE"];
		LEFTKNEE.animation["LEFTKNEE"].wrapMode = WrapMode.ClampForever;
	}

	// Update is called once per frame
	void Update () {

		if(Input.GetKeyDown("down")){
			B1A = true;
		}
		if(Input.GetKeyUp("down")){
			B1A = false;
		}
		if(Input.GetKeyDown("up")){
			B1B = true;
		}
		if(Input.GetKeyUp("up")){
			B1B = false;
		}

		if(B1A){
			Debug.Log("B1A = True");
			Bend1.speed = 1;
			LEFTKNEE.animation.Play("LEFTKNEE");
			if (Bend1.time < 0){
				Bend1.time = 0;
			}
		}
		if(B1B){
			Debug.Log("B1A = True");
			Bend1.speed = -1;
			LEFTKNEE.animation.Play("LEFTKNEE");
			if (Bend1.time > 1){
				Bend1.time = 1;
			}
		}
		if(!B1A && !B1B){
			Bend1.speed = 0;
		}
	}

Digital
Posts: 5
Joined: 16 Sep 2017, 04:27

Re: palidzat ar vien sik skript kam nav slinkums c#

#2 Post by Digital » 21 Sep 2017, 03:57

errori
Assets/scripts/test.cs(9,14): error CS1519: Unexpected symbol `:' in class, struct, or interface member declaration
Assets/scripts/test.cs(9,24): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
Assets/scripts/test.cs(10,11): error CS1519: Unexpected symbol `:' in class, struct, or interface member declaration
Assets/scripts/test.cs(10,26): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
Assets/scripts/test.cs(12,9): error CS1519: Unexpected symbol `:' in class, struct, or interface member declaration
Assets/scripts/test.cs(12,18): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
Assets/scripts/test.cs(13,9): error CS1519: Unexpected symbol `:' in class, struct, or interface member declaration
Assets/scripts/test.cs(13,18): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
Assets/scripts/test.cs(21,2): error CS9010: Primary constructor body is not allowed
Assets/scripts/test.cs(61,246): error CS1525: Unexpected symbol `end-of-file'

Digital
Posts: 5
Joined: 16 Sep 2017, 04:27

Re: palidzat ar vien sik skript kam nav slinkums c#

#3 Post by Digital » 21 Sep 2017, 06:09

ok ka jau teicu esmu noobs ..bet man pieleca ka skriptiem parada errorus tiesi tur kur ir skripta teikuma ..ha ..neesmu pilnigi bezcerigs ..bet tikunta man ir 1 errors
Assets/scripts/test.cs(59,247): error CS1525: Unexpected symbol `end-of-file'
un re kur izlabota versija

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class test : MonoBehaviour {

	public Animator anim;

	var LEFTKNEE=Transform;
	var test1=AnimationState;

	var B1Aboolean = false;
	var B1Bboolean = false;

	// Use this for initialization
	void Start () 
	{
		anim = GetComponent<Animator> ();
		test1 = LEFTKNEE.anim["LEFTKNEE"];
		LEFTKNEE.anim["LEFTKNEE"].wrapMode = WrapMode.ClampForever;
	
	}
		

	// Update is called once per frame
	void Update () {

		if(Input.GetKeyDown("down")){
			B1A = true;
		}
		if(Input.GetKeyUp("down")){
			B1A = false;
		}
		if(Input.GetKeyDown("up")){
			B1B = true;
		}
		if(Input.GetKeyUp("up")){
			B1B = false;
		}

		if(B1A){
			Debug.Log("B1A = True");
			LEFTKNEE.speed = 1;
			LEFTKNEE.anim.Play("LEFTKNEE");
			if (LEFTKNEE.time < 0){
				LEFTKNEE.time = 0;
			}
		}
		if(B1B){
			Debug.Log("B1A = True");
			LEFTKNEE.speed = -1;
			LEFTKNEE.anim.Play("LEFTKNEE");
			if (LEFTKNEE.time > 1){
				LEFTKNEE.time = 1;
			}
		}
		if(!B1A && !B1B){
			LEFTKNEE.speed = 0;
		}
	}
..edit
ne ..parlasiju erroru nozimes ..sapratu ka man erroru nav jo skriptus izsledzu ...tauta kas var palidzet?

Holybreath
Posts: 14
Joined: 06 Mar 2017, 13:18

Re: palidzat ar vien sik skript kam nav slinkums c#

#4 Post by Holybreath » 21 Sep 2017, 09:14

laikam trukst pedejas '}' beigas , lai klassi aizvert. (ja pareizi nokopeji visu)

Digital
Posts: 5
Joined: 16 Sep 2017, 04:27

Re: palidzat ar vien sik skript kam nav slinkums c#

#5 Post by Digital » 21 Sep 2017, 10:30

@Holybreath ..nee es vsp mudiitis esmu ..es tagat ilgi mekleju kas pa vainu ..es javaskriptu caur c# sadrukaju :D tagat vai nu japardruka uz c# ..
var B1A:boolean = false;
var B1B:boolean = false;
uz kauko
public bool B1A =false
....utt
vai ari ar javu jatiek gala ..ka jau teicu esmu nuubs pilnigs ..bet man shito skriptu dabut gatavu vaig ..lai varetu charu lidzigi ka QWOP vadit ..parejais man nav tik smags

Post Reply

Return to “Iesācējiem / For beginners”