Help making a targeting system.

The Partridge Family were neither partridges nor a family. Discuss.
albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Help making a targeting system.

Post by albinopapa » March 23rd, 2013, 5:51 am

In your unit constructors, are you trying to initiate more than one marine at a time? If so you need to specify a value for the 'for' loop. Amount.size is 0 because there isn't more than the one index and you have to add something to Amount to change it's size. You can, when you create a new marine or enemy unit, use

Code: Select all

Amount.push_back(Amount.size()+1);
Gets the number of indices in the vector Amount then add 1, then adds an index to the end, then stores the sum at that index.
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

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Help making a targeting system.

Post by albinopapa » March 23rd, 2013, 9:58 am

First off, I separated the files into .h and .cpp files. I was able to initialize the vector arrays. I saw a marine run across the screen when I hovered my mouse over a rectangle ( window is larger than my screen ).

Here you go.
Attachments
IncomeWars (organized) 03232013.zip
(657.33 KiB) Downloaded 129 times
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

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Help making a targeting system.

Post by cameron » March 23rd, 2013, 5:50 pm

OK thanks for the help. I finally got marines spawning how they should. Now I'm thinking of determining if its enemy or not by the player. Once that is done I have to get enemy marines working. After that I will need to implement the targeting system. Then I can easily add units to the game.
Computer too slow? Consider running a VM on your toaster.

Post Reply