Noob learns to code in 3 months
Re: Noob learns to code in 3 months
THINK I came up with a solution, wrote it down on paper and will try it out tomorrow
Edit: Change of plans, can't sleep. Let's get to the bottom of this *flex*
Edit: Change of plans, can't sleep. Let's get to the bottom of this *flex*
Re: Noob learns to code in 3 months
Feels like I'm adding a million functions to get this done will be a miracle if it works.chili wrote:Lol, I've been there.
Re: Noob learns to code in 3 months
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
https://github.com/Yumtard/Spaceballs
maybe I should just go back a ton and redo most of it and do bullets some other way
Re: Noob learns to code in 3 months
SOLVED! Through manic starring at the code
Here was the issue
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
Here was the issue
Code: Select all
for (int i = 0; i < nBullets; i++)
{
if (bullet[i].HasSpawned())
{
bullet[i].Update(dt);
}
if (hitTarget)
{
bullet[i].hasSpawned = false;
hitTarget = false;
}
}
Re: Noob learns to code in 3 months
Was poking around your project, looks cool . I did notice something that may be an issue
EDIT, i see you fixed it, good for you
Code: Select all
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
}
}
Curiosity killed the cat, satisfaction brought him back
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Noob learns to code in 3 months
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
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
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Noob learns to code in 3 months
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
Re: Noob learns to code in 3 months
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
then in mine.cpp I have this
in shield.cpp I have this
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
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: Select all
Shield& Ship::GetShield()
{
return shield;
}
Code: Select all
if (ship.GetShield().GetisActive() == false)
{
ship.Damage(damage);
}
in shield.cpp I have this
Code: Select all
if (meterWidth == 0)
{
isActive = false;
}
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
Re: Noob learns to code in 3 months
alrighty I see now I have Shield shield both in ShieldManager.h and in Ship.h which might cause trouble