Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: **Looking for developers help** take a look at this  (Read 12530 times)

0 Members and 1 Guest are viewing this topic.

Pacman

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
**Looking for developers help** take a look at this
« on: November 26, 2014, 12:43:42 am »
Hey i am doing a space shooting game.
So far i am proud of progress
I have an issue that every time i press space to a  shoot a bullet the first bullet that is fired disappears .
I am using a vector of the bullet to create and move the bullets
Why does this happen and how can i fix it ;

here is my main function
int main()
{
int i=0;
Ship shipObject;
Bullet bullletObject;
vector <Bullet> bulletArsenal;


    ///Creates the Window
    myGameGUI.create(sf::VideoMode(1000,680), "WorkingGameProject");
    sf::Style::Default;

    Background();///Creates the background

    ///calls function ship class and creates the ship
    shipObject.createShip(shipTexture, shipImage);


    while(myGameGUI.isOpen())
    {
     while(myGameGUI.pollEvent(action))
        {
        closeFunction();
        }
///Calls function from ship class and Moves the ship
shipObject.moveShip(action, shipImage,myGameGUI);

if(sf::Keyboard::isKeyPressed(sf::Keyboard::Space)){
        bulletArsenal.push_back(bullletObject);/// adds a new object to the vector
        bulletArsenal[i].createBullet(bulletTexture,bulletImage,shipImage);/// creates a bullet of a specific object
        }

        bulletArsenal[i].moveBullet(bulletImage); ///move the bullet of a specific object

        myGameGUI.clear();///clears screen
        myGameGUI.draw(backgroundImage);///draws the background
        shipObject.drawShip(myGameGUI,shipImage);///draws the ship
        bulletArsenal[i].drawBullet(myGameGUI,bulletImage);///draws the bullet of a specific object
        myGameGUI.display();
        i++;
 

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: **Looking for developers help** take a look at this
« Reply #1 on: November 26, 2014, 01:15:16 am »
It probably has something to do with the fact that you're only moving and drawing one of the bullets in your vector each frame.  Is that deliberate?  Do you know how to iterate over STL containers?


P.S. Those are very redundant comments.  Your variable names are good enough that the meaning of the code  is already obvious without them (as it should be).

Pacman

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
Re: **Looking for developers help** take a look at this
« Reply #2 on: November 26, 2014, 01:43:05 am »
It probably has something to do with the fact that you're only moving and drawing one of the bullets in your vector each frame.  Is that deliberate?  Do you know how to iterate over STL containers?

Will iterating the Vector allow more than one bullet to appear on the screen ?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: **Looking for developers help** take a look at this
« Reply #3 on: November 26, 2014, 01:49:30 am »
Whenever you want to do something with all the objects in a container, you want to iterate over that container.  Do you know what "iterating over a container" actually means?  It feels like you might be lacking a fundamental understanding of C++, which is necessary to use a library like SFML effectively.

Pacman

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
Re: **Looking for developers help** take a look at this
« Reply #4 on: November 26, 2014, 03:14:09 am »
Whenever you want to do something with all the objects in a container, you want to iterate over that container.  Do you know what "iterating over a container" actually means?  It feels like you might be lacking a fundamental understanding of C++, which is necessary to use a library like SFML effectively.

Just answer the question ...Yes or No or give me some valuable help
I see trying and have me like a clown ..doe never try that
« Last Edit: November 26, 2014, 03:17:01 am by Pacman »

Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
Re: **Looking for developers help** take a look at this
« Reply #5 on: November 26, 2014, 03:34:31 am »
Dont be rude. Iterating over anything doesnt magically make things appear on the screen, so the answer is no. Iterating will give you a way to access each item in the vector/list/array/whatever.


Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

StormWingDelta

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Re: **Looking for developers help** take a look at this
« Reply #8 on: November 28, 2014, 05:28:40 pm »
I might help but you are going to have to show some attempt at working on your project on your own first and show me what direction your are going with it. Got a huge Card game I'm working on though so won't be much help. 



The key to building a team on this forum is to show you are trying to complete a good chunk of your project first, provide a GDD (Game Design Document) or Program Design Document of some kind so we know what you are up to and if it is even worth trying to help, also no one here is going to code this for you without you also helping with the coding as well or some other part you are good at.

There are other ways but basically asking a group to code for you and griping about us not wanting to help never ends well.
I have many ideas but need the help of others to find way to make use of them.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: **Looking for developers help** take a look at this
« Reply #9 on: November 28, 2014, 07:44:30 pm »
Got a huge Card game I'm working on
Card game?
*cough* Spinning Card *cough*
Hope it's of some use to you  :P
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

StormWingDelta

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Re: **Looking for developers help** take a look at this
« Reply #10 on: November 28, 2014, 08:57:44 pm »
Got a huge Card game I'm working on
Card game?
*cough* Spinning Card *cough*
Hope it's of some use to you  :P

lol might be useful later but I'll need to get things working normally before adding some flare in. :)
I have many ideas but need the help of others to find way to make use of them.

Pacman

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
Re: **Looking for developers help** take a look at this
« Reply #11 on: November 30, 2014, 02:09:47 am »
 


also no one here is going to code this for you without you also helping with the coding as well or some other part you are good at.

There are other ways but basically asking a group to code for you and griping about us not wanting to help never ends well.


I didnt ask anybody to write code for me and i dont need anybody to write code for me... The Partner made a comment and made it seem that i wasn't good enough for SFML so i stood for my right

Pacman

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
Re: **Looking for developers help** take a look at this
« Reply #12 on: November 30, 2014, 02:12:52 am »


It looks like you want the SFML community to write every other line of your game for you.

BE CAREFUL WHAT YOU SAY !

i made great progress on my game i did it on my own with the help of research, i didnt get any valuable response to help me with my game in any of the post i made... and why you looking at my profile so closely. stop lurking boy.
AND
I didnt ask anybody to write code for me and i dont need anybody to write code for me... The Partner made a comment and made it seem that i wasn't good enough for SFML so i stood for my right
« Last Edit: November 30, 2014, 02:18:50 am by Pacman »

Pacman

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
Re: **Looking for developers help** take a look at this
« Reply #13 on: November 30, 2014, 02:21:17 am »
:o
Knuth would turn over his grave =.=


Why would knuth turn over in his grave  ???

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: **Looking for developers help** take a look at this
« Reply #14 on: November 30, 2014, 04:45:51 am »
BE CAREFUL WHAT YOU SAY !
...
why you looking at my profile so closely.
Why are you threatening me? I'm pretty sure I don't deserve to be bullied for pointing out that what you have done.

I didn't look closely at your profile. I simply remember you posting the same (almost) question a number of times and wondered if you had actually posted anything else. Alas, you had not.

If you think my sentence was incorrect, wouldn't the correct thing to do be just prove that it was incorrect and why?

You are looking for "help". I, for one, will no longer consider contributing to your help.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*