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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Pacman

Pages: 1 [2]
16
General / Shooting projectiles Straight **Advice needed***
« on: November 23, 2014, 01:21:26 am »
Hey SFML coders !
How do i get a sprite to be fired as projectile and move straight ahead .

Please explain Precise and simple ... your knowledge will be appreciated
Here is the code i have.

 
/////////////////////////////
   ///Create the bullet
////////////////////////////
void Bullet::createBullet(sf::Texture &bulletTexture, sf::Sprite &bulletImage, sf::Sprite &shipImage)
{
  if(!bulletTexture.loadFromFile("Images/missile.png"))///creates the bullet
        cout << "ERROR:bullet could not load" << endl;

    bulletImage.setTexture(bulletTexture);///
    sf::Vector2f shipLocation = shipImage.getPosition(); ///Gets the location of the ship

    float locationX = shipLocation.x - 83;///sets the X location of the ship places the bullet of  it
    float locationY= shipLocation.y +4 ;///sets the Y loction of the ship

    bulletImage.setPosition(locationX, locationY);
}
 

////////////////////////
///Move the bullet
////////////////////////
void Bullet::moveBullet(sf::Sprite &bulletImage, sf::Sprite &shipImage)
{
    float moveX = shipImage.getPosition().x;
    bulletImage.move(-3,0);
}

 


17
SFML projects / How to make a space ship shoot bullets ??
« on: November 15, 2014, 05:49:19 am »
I am new to SFML. I just started a space game project.
I have made good progress.
I would like help as to how do i make my ship shoot bullets using STL containers.
I have no idea how i should start.


if you wouldnt mind maybe you could be my mentor, we could talk on keep in touch on facebook.  i am from the caribbean .
I would appreciate the help.

void bullets()
{


}

18
SFML projects / Space shooting Game
« on: November 12, 2014, 10:07:59 pm »
I am new to sfml and i am doing a space shooting game that should have  :
- a space ship that shoots bullets
- asteroids that move towards the ship

i have the ship and it is moving perfectly .
I am trying to create the bullets and make the ship fire the bullets.
I have no idea how to start to create the bullets or make the ship fire 

Can some please guide me as to how to do this ?
Or direct me to an example of code
PLEASE BE SPECIFIC !!

Pages: 1 [2]