- Home /
Bomberman like movement
Sorry it's my first time using Unity. If my question is too dumb or somewhere existed please easy on me.
I'm trying make some bomberman game on Unity. Camera will see it from top. And right now i'm only starting and trying make some movement. But on my current code, it's moving directions i don't want. For example, if you press W and D same time, it moving to top right corner. I still can't decide what happen if player press W and D same time. It should go top or right? Also how I disable unwanted angle movements.
function Update () {
if(Input.GetKey("w")) {
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
}
if(Input.GetKey("s")){
transform.Translate(Vector3.back * moveSpeed * Time.deltaTime);
}
if(Input.GetKey("d")) {
transform.position += transform.right * moveSpeed * Time.deltaTime;
}
if(Input.GetKey("a")) {
transform.position -= transform.right * moveSpeed * Time.deltaTime;
}
}
Do you know some bomberman or same game tutorial? I searched from youtube, found one bomberman but that's not on english. if you know, please give me link :)
Answer by gajdot · Nov 15, 2013 at 03:02 PM
Use if else statements instead of only using ifs in that way it will only record one direction and you won't get angles in your movement.
I changed it to be an answer so you can accept it. We'll I don't know any which is bomberman like, but if you have any question I'm happy to answer.
PS. I'm planning to create a tutorial channel on youtube, so if you have some special request what are you specially interested in a tutorial, maybe I can make one for you.
Of course that's unbelievable offer for me. But i don't want you waste your time for me :(
I just posted my current progress and asked few questions here. please review it, when you have some free time :) http://answers.unity3d.com/questions/578728/problems-while-making-bomberman.html
$$anonymous$$, as soon as it gets visible I'll try to help.
Your answer
Follow this Question
Related Questions
How can i rotate my character smooth using keys ? 0 Answers
My Character Controller Is Warping Randomly (/w video) 0 Answers
How to detect angles of walls? 1 Answer
Character Controller, changing collider's size? 0 Answers
Problem with Movement Script 0 Answers