public void Update(Vector2 _position) { position.X = _position.X; if (position.X >= CDino.position.X && position.X <= CDino.position.X + CDino.drawRec.Width * Game1.scale && position.Y >= CDino.position.Y && position.Y <= CDino.position.Y + CDino.drawRec.Height * Game1.scale) { Game1.score = 0; if (audio_played != true) { CSoundManager.PlaySound(1); audio_played = true; } } }
public void Update() { if (CKeyboard.SpacePressed()) { if (position.Y == defPosY) { position.Y -= 1f; velocity += 5; OnGround = false; CSoundManager.PlaySound(0); } } Gravity(); if (velocity < 0 && CKeyboard.DownArrowPressed() && OnGround == false) { velocity -= 0.3f; } Animate(); }