Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 630 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 63  Next
Author Message
 Post Posted: January 31st, 2017, 2:35 am 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 497
Location: Idiot from northern Europe
THINK I came up with a solution, wrote it down on paper and will try it out tomorrow :D


Edit: Change of plans, can't sleep. Let's get to the bottom of this *flex*

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: January 31st, 2017, 3:53 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3484
Location: Japan
Lol, I've been there. :)

_________________
Chili


Top 
 Profile  
Reply with quote  
 Post Posted: January 31st, 2017, 4:13 am 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 497
Location: Idiot from northern Europe
chili wrote:
Lol, I've been there. :)


Feels like I'm adding a million functions to get this done :D will be a miracle if it works.

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: January 31st, 2017, 3:57 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 497
Location: Idiot from northern Europe
Hate to keep bothering for help but been clicking buttons, googling and debugging all night. Now I've got it so every third bullet hits but the other 2 goes right throught. No idea why

https://github.com/Yumtard/Spaceballs

maybe I should just go back a ton and redo most of it and do bullets some other way

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: January 31st, 2017, 5:19 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 497
Location: Idiot from northern Europe
SOLVED! Through manic starring at the code

Here was the issue

Code:
for (int i = 0; i < nBullets; i++)
      {
         
         if (bullet[i].HasSpawned())
         {
            bullet[i].Update(dt);
         }

         if (hitTarget)
         {
            bullet[i].hasSpawned = false;
                                hitTarget = false;
         }
         
         
      }


So hitTarget becomes false for the second and third iteration. Moved "hitTarget = false;[/code]" to after the for loop and voila, works. My code feels a bit messy and there should be neater more simple ways to solve my problems, for example hasSpawned is public, but for now I'm just very happy it works

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: January 31st, 2017, 5:42 pm 
 

Joined: November 30th, 2013, 7:40 pm
Posts: 612
Location: Merville, British Columbia Canada
Was poking around your project, looks cool :). I did notice something that may be an issue
Code:
void MineManager::Update(Ship& ship, float dt)
{
   for (int i = 0; i < nMines; i++)
   {
      if (mine[i].isActive())
      mine[i].Update(ship, dt);// here you check collision
      wasHit = mine[i].GotShot(ship, ship.GetnBullets());// here you check collision again
    }
}

EDIT, i see you fixed it, good for you :)

_________________
Curiosity killed the cat, satisfaction brought him back


Top 
 Profile  
Reply with quote  
 Post Posted: January 31st, 2017, 8:14 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2842
Location: Oklahoma, United States
https://github.com/albinopapa/Spaceballs

Here's some edits and additions that might help, it's not completely working yet, but maybe you'll get the idea and finish it up :)

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
 Post Posted: January 31st, 2017, 8:15 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2842
Location: Oklahoma, United States
Damn, you fixed it before I could finish

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
 Post Posted: January 31st, 2017, 10:58 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 497
Location: Idiot from northern Europe
Gonna check it out in a minute guys! Really appreciate all the help you're giving.

Today has been a superbuggy day. Think i might be in over my head with this game.
Every time an issue is solved I get a new one.
This time I tried to make a shield for the ship. Visually it works but after the shield is gone the ship still wont take any damage.
Only thing I can think of is this:

in ship.cpp I have this
Code:
Shield& Ship::GetShield()
{
   return shield;
}


then in mine.cpp I have this
Code:
if (ship.GetShield().GetisActive() == false)
            {
               ship.Damage(damage);
            }



in shield.cpp I have this

Code:
if (meterWidth == 0)
      {
         isActive = false;
      }


the starting value of isActive in shield.cpp is true.
In other words the ship shouldn't take damage while the ship is active, then when the meter runs out isActive should become false and the ship should start taking damage again.
but isActive doesn't seem to ever become false
The only thing I can think of is that I'm returning the actual class which has isActive set on true rather than returning the shield object from ship



edit: MIGHT have thought of a solution, 5% chance of working
edit 2: nvm, no clue

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: January 31st, 2017, 11:25 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 497
Location: Idiot from northern Europe
alrighty I see now I have Shield shield both in ShieldManager.h and in Ship.h which might cause trouble

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 630 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 63  Next

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron