This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if player collides | |
| check if collision is object,x,y,z | |
| if | |
| object x - -5 from life | |
| object y - -10 from life | |
| object z - - 15 from life | |
| if players health <0 player loses |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pseudocode for pickups | |
| when gameobject 'player' collides with object, check if object is wall or ammo | |
| if collision is with ammo, check if players ammo = >10 | |
| if ammo is = >10, de activate gameobject 'ammo' and change ammo to 10 | |
| respawn gameobject ' ammo' 15 seconds after de activation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| psuedocode for instantiation | |
| check if player has ammo, when player has 'x'amount of bullets, allow 'x' amount of shots | |
| when key 'ctrl' is pressed spawn gameobject 'bullet' at gameobject 'spawn' transfrom postion | |
| when bullet has been spawned, apply force 'speed = x' | |
| if bullet collides with gameobject ' target' set 'target' to unactive | |
| when all targets are unactive display message "you win" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pseudocode for player movemnt | |
| when key 'd' is pressed, apply force in direction 'right' | |
| when movement = 'right' play animation ' right movement' | |
| when key 'a' is pressed, apply force in direction 'left' | |
| when movement = 'left' play animation 'left movement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* if user presses fire button | |
| * Create copy of bullet template | |
| * Spawn the bullet at firing point | |
| * move the bullet using physics relative to the player | |
| */ | |
| /* | |
| * Bullet variable | |
| * Fire point variable | |
| * Bullet speed variable | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PlayerController : MonoBehaviour | |
| { | |
| private float flyingSpeed = 300f; | |
| private float rotationSpeed = 50f; | |
| private Rigidbody2D rb2d; | |
| private bool canBoost = false; | |
| private float boostAmount = 5f; | |
| void Start() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void Update() | |
| { | |
| if (Input.GetButtonDown("Jump") && onGround) | |
| { | |
| jump = true; | |
| } | |
| } | |
| void FixedUpdate() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Update() | |
| { | |
| if(Input.GetKeyDown(KeyCode.Q)) | |
| { | |
| GetComponent<SpriteRenderer>().color = Color.blue; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CameraController : MonoBehaviour | |
| { | |
| public GameObject Player; | |
| private Vector3 offset; | |
| // Start is called before the first frame update | |
| void Start() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PlayerController : MonoBehaviour | |
| { | |
| public float speed; | |
| private Rigidbody rb; | |
| void Start() | |
| { | |
| rb = GetComponent<Rigidbody>(); |
NewerOlder