Gamedev Project 1
Gamedev Project 1
CarGame 3D
Game code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
capsule.velocity=new
Vector3(horizontalInput*movementspeed,capsule.velocity.y,verticalInput*movementspeed);
// Debug.Log("Hello from Update!");
if(Input.GetButtonDown("Jump") && IsGrounded()){
capsule.velocity=new Vector3(capsule.velocity.x,jumpForce,capsule.velocity.z);
}
bool IsGrounded(){
return Physics.CheckSphere(groundCheck.position,.1f,ground);
}
/*--> ye code bhi thik hai but perfect nhi smjhe bhai <--
// if(Input.GetKey("up")){
// capsule.velocity=new Vector3(0,0,5);
// }
// if(Input.GetKey("right")){
// capsule.velocity=new Vector3(5,0,0);
// }
// if(Input.GetKey("down")){
// capsule.velocity=new Vector3(0,0,-5);
// }
// if(Input.GetKey("left")){
// capsule.velocity=new Vector3(-5,0,0);
// }
*/
Game Screenshots :