Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


jellyfishchris

Member Since 19 Apr 2012
Offline Last Active Nov 23 2013 12:46 AM

Posts I've Made

In Topic: Can't figure out what is wrong with my code in c++

26 May 2013 - 08:00 PM

This code does not compile, here is the log to help you :)

 

error C2360: initialization of 'currentgameState' is skipped by 'case' label


In Topic: My First Text Based RPG help

15 May 2013 - 10:55 PM

For those of us that cant read code formatted like that:

http://codebin.org/view/94bf6d09

 

Ok I am confused what you actually what the program to do so I am just going to stab in the dark.

 

while (eHealth > 0)
{
	eHealth - attack;

	if (eHealth <= 0)
	{
		cout<< "You have killed the goblin."<< endl;
		cout<< endl;
		++stats;
		break;
	}
}

In your loop you are doing eHealth - attack.

 

So lets think about this, your doing the golbins health minus attack which is 1. Now you never store the 1 and it is just forgotten about. Now ehealth is greater than 0 because its still 8 because it is never saved. Now the program will go into an infinite loop.

 

However lets fix this and do eHealth = eHealth - attack;

First loop:

  eHealth = 1;

  do if statement = no

Second loop:

  eHealth = -6;

  do if statement = yes

    output "You killed the goblin \n"

    add one to stats;

    break while loop;

 

Additionally stats was never assigned so you will get a runtime failure, so if you change it to int stats = 0;

 

Ok your next question is going to be it comes up with but it also printed "You have died" this is becuase you have forgotten to add a break statement for the case of attacking the goblin. So it will execute case1 which you kill the goblin, it never finds a break to break the case so it does case2 also then case2 finds a break and finishs.

 

Hope this is enough information and good luck!


In Topic: COLLADA or FBX?

15 May 2013 - 12:38 AM

FBX hands down, after writing my own collada loader and fbx loader as part of a personal project. FBX is much much much easier.(For me atleast)


In Topic: calculator app

13 May 2013 - 01:01 AM

Here is something to think about. What if I enter in:

7 + (6 × 52 + 3)

 

http://www.mathsisfun.com/operation-order-bodmas.html


In Topic: Voxel engine load times

30 April 2013 - 06:45 PM

Ok, Ill try this when I get home.

Thanks for the advice


PARTNERS