Embarrasing!!!

  • Thread starter Kakea
  • Start date
  • #21
I answered that lol, there's a sprite editor in unity for 2D games, but if you want to make a sprite sheet or an atlas yourself, then use GIMP/Photoshop or any other photo editing software like I said :p
 
  • #22
Well, that's how I learnt how to use Unity. Was through the tutorials on that site. Those are designed for people who have never played around with whatever the tutorial is for, and then through them you slowly start to learn what you have to do.

Just underneath the video title when you go to the page for it, it'll tell you what level of difficulty the tutorial is:
LR6U0sL.png
nqqTZCx.png


"how typing anything into it, would bring any result."
Now you're getting to the coding, and probably the hardest, part. Just randomly typing things isn't gonna work. You gotta pick a language to code something in, then use it in that specific editor.

This is the code from this tutorial: https://unity3d.com/learn/tutorials/topics/2d-game-creation/bird-script?playlist=17093
Code:
using UnityEngine;
using System.Collections;

public class Bird : MonoBehaviour
{
    public float upForce;                   //Upward force of the "flap".
    private bool isDead = false;            //Has the player collided with a wall?

    private Animator anim;                  //Reference to the Animator component.
    private Rigidbody2D rb2d;               //Holds a reference to the Rigidbody2D component of the bird.

    void Start()
    {
        //Get reference to the Animator component attached to this GameObject.
        anim = GetComponent<Animator> ();
        //Get and store a reference to the Rigidbody2D attached to this GameObject.
        rb2d = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        //Don't allow control if the bird has died.
        if (isDead == false)
        {
            //Look for input to trigger a "flap".
            if (Input.GetMouseButtonDown(0))
            {
                //...tell the animator about it and then...
                anim.SetTrigger("Flap");
                //...zero out the birds current y velocity before...
                rb2d.velocity = Vector2.zero;
                //  new Vector2(rb2d.velocity.x, 0);
                //..giving the bird some upward force.
                rb2d.AddForce(new Vector2(0, upForce));
            }
        }
    }

    void OnCollisionEnter2D(Collision2D other)
    {
        // Zero out the bird's velocity
        rb2d.velocity = Vector2.zero;
        // If the bird collides with something set it to dead...
        isDead = true;
        //...tell the Animator about it...
        anim.SetTrigger ("Die");
        //...and tell the game control about it.
        GameControl.instance.BirdDied ();
    }
}

What I like about the Unity tutorials is that it explains each line of code using comments. (The lines starting with //). Of course, for this bit though if you want to do it, you could learn C# separately. Of course, this script on it's own wont work as it's depending on different things. Best way to learn C# for this imo though is to just go through the tutorials and code while learning. It'll be quicker and easier then going through learning C# separately (and more fun).


I will look again, and try it... But, I only wanted to remind you, before I look: I said I've typed coding directly from tutorials before now, it never has worked. But I'm willing to try again, off hand... if you're posting code: Would you post something for a simple sidescroller?

I want to start off with something like this, and (I never got why people like FlappyBird :D) I think if I could learn what code means: Characters, object, enemies ect. It'll become easy! I have coded a little using Minecraft Pocket Edition Mods... I'll learn easier with labels showing what number/lettering does what, and where it'll be.
 
Back
Top