Jump to content
  • Advertisement

Hung

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

100 Neutral

About Hung

  • Rank
    Newbie
  1. Hung

    While Loop Crashes Game.

    Alright, so I got it to work, but now I have another issue. Now it just loops through it so fast and the bullet gets to end of the screen as soon as you click. I tryed to pause/delay it, but they it just crashes the game. if(Shot == true) { while(dbSpriteX(4) > 0 && dbSpriteX(4) < 640 && dbSpriteY(4) > 0 && dbSpriteY(4) < 480) { dbMoveSprite(4,-1); dbWait(1000); } } } void Shoot(void) { float angle = dbAtanFull(dbSpriteY(2) - dbMouseY(), dbSpriteX(2) - dbMouseX()) + 90; Shot = true; dbSprite(4,dbSpriteX(2),dbSpriteY(2),4); dbRotateSprite(4, angle); } My new code.
  2. Hung

    While Loop Crashes Game.

    I see, alright. Can you help me with a timer or something to fix it?
  3. Hung

    While Loop Crashes Game.

    Shot isn't always true, it's only true if you click the mouse and my sprite doesn't run out of bounds. What do you mean by it doesn't leave the loop between passes?
  4. Alright so I'm trying to make a function so my player can shoot. void Shoot(void) { float angle = dbAtanFull(dbSpriteY(2) - dbMouseY(), dbSpriteX(2) - dbMouseX()) + 90; bool shot = false; if(dbMouseClick()) { dbSprite(4,dbSpriteX(2),dbSpriteY(2),4); dbRotateSprite(4, angle); shot = true; } while(shot == true) { dbMoveSprite(4,-66); } } When I click, the game crashes. Without the while loop it doesn't crash. What am I doing wrong?
  5. Hey, I was wondering what Library should I get started with? I really only know of SDL, SFML, Allegro, DarkGDK. Which do you prefer a beginner to use?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!