Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Linux keyboard and sound problems

$
0
0

@Stephan_Goldenberg wrote:

Hi,

I'm at the final stage of the project from DrT's course at coursera.

First: The autofire does not work as intended using the keyboard.

It did work using the mouse, I'm reusing the same logic. You should be able to spam the space bar for rapid fire and when you keep it pressed there should be a constant fire rate. It does shoot in weird bursts then and another burst when the space bar is released.

// shoot if appropriate
if (keyState.IsKeyDown(Keys.Space) && health > 0){
if (canShoot){
canShoot = false;
Projectile projectile = new Projectile(ProjectileType.FrenchFries, Game1.GetProjectileSprite(ProjectileType.FrenchFries), drawRectangle.X + drawRectangle.Width / 2, drawRectangle.Y + drawRectangle.Height + GameConstants.FrenchFriesProjectileOffset, GameConstants.FrenchFriesProjectileSpeed);
Game1.AddProjectile(projectile);
shootSound.Play();
} else{
elapsedCooldownMilliseconds += gameTime.ElapsedGameTime.Milliseconds;
}
}
if (elapsedCooldownMilliseconds >= GameConstants.BurgerTotalCooldownMilliseconds || keyState.IsKeyUp(Keys.Space)){
canShoot = true;
elapsedCooldownMilliseconds = 0;
}

Second: Sound does just produce terrible noise. There are several shoot and bounce sounds, which were provided as .wav files. The pipeline tool did not complain. It worked for the shooting sounds but after adding the bouncing sounds it just a high pitched noise.

[oppa@oppa-hex-ssd ~]$ uname -a
Linux oppa-hex-ssd.oppator 4.15.12-301.fc27.x86_64 #1 SMP Thu Mar 22 19:25:27

UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Any ideas, esp. with the keyboard issue ? I guess the sound problem is down to some problems with converting from .wav to .xnb. In a first exercise I had a 'boing' sound which was just some weird sound after converting.

Happy Easter,
Stephan

Edit: Yep, there is one very short 'tick' sound for the bounce effect which is corrupted by the "translation" from .wav to .xnb. When I remove these from the project the rest of the sound effects are fine. Still the auto fire problem.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles