Hello Forums,
Unfortunatly things have happened and I have become crunched for time on this.
I have a project due this Monday.
What I have done:
I am currently using a modded 3D tutorial and have made it so that it is now actually a 2D game.
To do this I have made the character on move on one axis, and maxed out the turn speed to keep the player Lerpz from falling off the platform on the z axis. I have created a 2nd punch animation button now.
What I am looking to do.
I am looking to create a combination of keys to cause this punch animation and at a point in that animation a projectile will shoot from an invisible gun in a desired direction.
What I need help with please.
I need to find a way to make the projectile to be created the projectile.
I need to have it done with a combination of keys
I need to have the projectile fired at a specific time in the animation by delay, or keyed to that frame in the animation.
I know this is probably a tall order considering the time restrains. Now I also know I might not be able to get all of this done in time, but I am trying to learn how to do it.
Thank you very much for your help.
Define “Combination”
Do you mean shift+ctrl+f or do you mean the StreetFighter “down down-forward forward punch” hadoken?
Triggering an event at a specific frame can be achieved by using AnimationEvents. These work like CuePoints in common video editing software. You can add them by right clicking around the time bar in the Unity Animation window - the functions available to be turned into AnimationEvents must be contained in a script attached to the object you are animating. Look up documentation on AnimationEvent and search on the forums for details on that stuff.
StreatFighter style exactly. I got some notes I am trying to figure out now on to create a gun function.
I would also like to add that I have had little experience with this or any engine. So coding is very difficult.
Thanks for the help!
P.S.
Here is the bullet code I am working with. I can’t seem to figure out what the problem is. Can someone please help?
var bullet : GameObject;
var newBullet = Instantiate (bullet, transform.position, transform.rotation);
function Update ()
{
If(Iimput.GetButtonDown("Shoot"));
Instantiate;
{
newBullet,ridgidbody.AddForce(trasnform,forward * speed);
}
}
I seem to be having some trouble with this script. It appears that the bullet is spawning at different Y Heights at random for some reason. Can anyone please figure out what is going wrong?
Bullet Spawn
var shootspeed = 10;
function Shoot (bullet : Rigidbody)
{
var shot = Instantiate(bullet,transform.position,transform.rotation);
shot.velocity = transform.TransformDirection (Vector3.forward * shootspeed);
}
Bullet Script
function Awake ()
{
Destroy(gameObject,3.0);
}
function OnCollisionEnter (collision : Collision)
{
collision.transform.BroadcastMessage("ApplyDamage",1);
Destroy(gameObject);
}
Thank You very much!
for the first code you have some spelling errors, try to correct that first see if it does work.