Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


v0rtexza

Member Since 14 Jun 2012
Offline Last Active Nov 19 2012 04:11 PM

Posts I've Made

In Topic: Best OpenGL books for beginners (C++)

19 November 2012 - 01:40 AM

I purchased beginning opengl game programming, second edition and am reading the arcsynthesis online book while I wait for my book to arrive. The beginning opengl game programming book looks like it leaves a lot out which is understandable, what would be a good follow up book? I was thinking of more opengl game programming? Any other ideas is awesome. Thanks all!

In Topic: Limiting Bullets and stopping spamming - DirectX

01 July 2012 - 02:01 PM

Nevermind, got it working with the following:

I set a long variable to 0 that would hold the last time the player shot and then I did the following

[source lang="cpp"] if ((int)timeGetTime() < lastShot + 100) return; else {//shoot bullet}[/source]
Thanks everyone, for all your help!

In Topic: Limiting Bullets and stopping spamming - DirectX

01 July 2012 - 02:34 AM

Sorry as an addendum to my last post (as I can't edit!?)
After the second last bracket, I had:
[source lang="cpp"]}}else keySpaceIsHeld = false;}[/source]

In Topic: Limiting Bullets and stopping spamming - DirectX

01 July 2012 - 02:29 AM

Thanks fastcall22, I tried your first solution:

[source lang="cpp"] if (Key_Down(DIK_SPACE)) { //limit firing rate // if (GetTickCount() - player_shoot_timer > 100) return; //player_shoot_timer = GetTickCount(); if (!keySpaceIsHeld) keySpaceIsHeld = true; if (keySpaceIsHeld) { if (CurrentBullet == MAX_BULLETS -1) return; //CurrentBullet = Max Ammo, So Exit if (CurrentBullet < MAX_BULLETS) //If there are bullets available { bullets[CurrentBullet].alive = true; bullets[CurrentBullet].x = player.x + (player.width/2); bullets[CurrentBullet].y = player.y; } } }[/source]

But It still does what it did and increases CurrentBullet a lot instead of by 1 upon each keypress. Editing my windows code to work with my main code sounds like a massive hassle as I would have to rewrite ALOT of my code... Sorry to bother man, you've been a lot of help!

In Topic: Limiting Bullets and stopping spamming - DirectX

01 July 2012 - 01:15 AM

Wow lol, was focusing so much on the graphics and DirectX that I forgot something as simple as that. Thanks! My only last problem is that I do not know how to space input, so that for example when you click space. Only 1 shot is registered, at the moment whenever space is held down, my variable CurrentBullet (as seen in the listing above) continually increases as much as I click instead of only registering one click. Any ideas?

PARTNERS