Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

mypel16000

Member Since 31 Oct 2012
Offline Last Active Apr 07 2013 02:10 PM

Posts I've Made

In Topic: Advanced C++

04 April 2013 - 03:18 PM

@BaneTrapper

Yes, that's the advice everyone used to give me, so I started developing a game, and, you are right. After developing something simple, I was able to add a lot of features to my game engine! However, I believe that A* pathfinding algorithm is somewhat too complex to just think it through. I've been trying to implement someone else's, but it uses queues, maps, nodes and thinks I have no idea what they mean. I'm trying to read Bjarne Stroustrup¡s C++ book, but it's too long and mixes the stuff i know with what i dont...


In Topic: Shooting in SFML

02 April 2013 - 02:58 PM

OH my GOD!! Thank you Arhim, if you look at my code, the plan was to write 

 

bulletY += ((move_YOffset*0.1)) ;

 

y no

 

bulletY += ((shot_YOffset*0.1)) ;

 

Just a silly coding mistake... THANKS EVERYONE!


In Topic: Shooting in SFML

02 April 2013 - 02:32 PM

Here's my code:

 

void Projectile::shot_CheckDirection(sf::RenderWindow& window, Player& player, int mouseX, int mouseY)
{
        bulletX = (int)player.playerSprite.GetPosition().x ;
        bulletY = (int)player.playerSprite.GetPosition().y ;

        shot_XOffset = mouseX -( bulletX );
        shot_YOffset = mouseY -( bulletY );
        shot_RotationAngle = (atan2(shot_XOffset, shot_YOffset));
        bulletSprite.SetRotation( (shot_RotationAngle * 180 / 3.14159265) );

        shot_Length= sqrt(shot_XOffset*shot_XOffset + shot_YOffset*shot_YOffset);
}

void Projectile::shot_Move          (sf::RenderWindow& window)
{
    move_XOffset = (int)shot_XOffset;
    move_YOffset = (int)shot_YOffset;

    move_XOffset /= shot_Length;
    move_YOffset /= shot_Length;

    bulletX += ((shot_XOffset*0.1))    ;
    bulletY += ((shot_YOffset*0.1))   ;

    bulletSprite.SetPosition((int)bulletX, (int)bulletY);
    window.Draw(bulletSprite);
    frameCounter++;
}

In Topic: Shooting in SFML

02 April 2013 - 01:36 PM

No, it was different, I didn't know how to use this method.

They are floats, but that's not the point. The point is that the closer you get the mouse to the player (as the distance gets smaller), the slower the projectiles go. But when the distance is larger, the projectiles go so fast, you only see like 3 images in the screen of the bullet sprite because its so quick!


In Topic: Adding a storyline

01 March 2013 - 03:41 PM

@andy474: I think you are forgetting that this forum is the "for begginers forum". Yes it is hard to interpret such a poorly elaborated answer.

 

@Bcullis: I know, I'ts just that I'm making the framework of my game still as my graphic designer hasn't caught up to me. I can't carry on the basics and I don't have a map yet. I'll try some methods, but I was just asking if there was a good accepted method to do this. Thanks for the advice though :)

 

@haegarr: Very good explanation, it kind of gives me an idea of what I need to implement into my game. I ill start having a class "World" with all these flags and simply have another class for the storyline that takes in a reference to the world and has a series of if statements an an int to keep track of the mission the player's in. Kind of like:

 

- IF( mission == 4 && 6700 < playerX > 6650 && 8700 < playerY > 8650 && playerAbilityConversation > 50) bla bla bla

You think thats OK?


PARTNERS