001 - Unity Game - Lets make a game

preview_player
Показать описание
Unity tutorial on making a game. This is part 1 in a series of tutorials on getting started in game making.

-- For any question or requests, feel free to comment!

In this episode we go from start to almost where we are up to as I catch up wth updating to Unity4

--- Movement script

#pragma strict
var moveSpeed : float = 1;
var canjump = false;

function Update () {

if (Input.GetButton ("w")){

}

if (Input.GetButton ("a")){

}

if (Input.GetButton ("s")){

}

if (Input.GetButton ("d")){

}

if (Input.GetButton ("space")){

if (canjump){

gameObject.AddComponent("joeJump");

}

}

}

function OnTriggerEnter(other : Collider){

canjump = true;

}

}

function OnTriggerExit(other : Collider){

canjump = false;

}

}

--- Jump Script:

#pragma strict
var jumpSpeed : float = 1;

function Start () {

wait();

}

function Update () {

}

function wait(){

yield WaitForSeconds(0.1);

Destroy(this);

}

---- Random enemy AI on next video description
Рекомендации по теме
Комментарии
Автор

Thanks for the feedback, it's a simple solution although not ideal, but it allows for some simple re-usable code that can be changed depending on the environment or the game it is used in, changing the shape of the trigger and such could be an option for different outcomes.

Createathing
Автор

i never seen this technique for jumping before really help me out thanks

rasheedqe
Автор

this may also be a cause for the problem, thanks for the input!

Createathing
Автор

This is even better then the official stuff on there page i approve! (y)

Mjauswe
Автор

i would check the tag on the enemy make sure its not ground

rasheedqe
Автор

If you mean the scripts, they are in the description of each videos, otherwise, please elaborate on what you mean.

Thanks!

Createathing
Автор

Sorry for the late reply, I have tried to test it based on what you mentioned and cannot achieve the same bug, be sure to follow the script exactly and copy it in from the description if necessary. The only other thing I can suggest is follow the next few tutorials as I tweak the scripts and hopefully this will fix it, otherwise, feel free to comment here again or message me personally and I will take a closer look!

Createathing
Автор

can u post your sources code of this proj?
thx.

koemanqiu
Автор

Nice day Createathing!
I really enjoy all your videos about unity, so helpful for beginner like me, but in this chapter, i followed your script, it worked perfectly until the player collide with the enemy, it cannot jump anymore, i noticed that the "canjump" variable turn false after the player collide the enemy. Please you help me how to fix

dzuncoi