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 - Gobbles

Pages: 1 ... 5 6 [7] 8 9
91
General / Re: Can't compile tutorial code - it's been 2 days by now
« on: August 07, 2013, 04:28:31 am »
While I'm not overly familiar with codeblocks, I'll throw some ideas at you.

Are you trying to build debug? you mention "sfml-graphics-s", however you would need sfml-xxx-s-d for debug. xxx being the library names (graphics, window, audio, system, network).

92
Graphics / Re: Too big textures...
« on: August 06, 2013, 08:12:56 pm »
How big is the map? Is it much larger then what your camera can see?

If this is the case try to only retrieve what your camera can see and just draw that, as there's no point in drawing images that are 2000 pixels off screen.

93
General / Re: Lethn's Programming Questions Thread
« on: August 04, 2013, 07:20:54 am »
This is where setting up an animation class for a Texture Atlas(a sprite sheet) really comes in handy.
Creating a class that will allow you to load in a new texture, give the animation a name, how many frames, whether it should auto-repeat(like an idle animation) or not (like an attack animation) and also set up the sprite rectangle to use for each frame will also be handy.

Animations are complex stuff and setting them up varies greatly on what you need. Its up to you as the programmer to decide what you need and how to implement it. Such is what game programming is all about after all.

94
General discussions / Re: SFML Game Jam Theme Announcement!
« on: August 02, 2013, 04:42:38 pm »
Good luck to all, I look forward to seeing what kind of concoctions are whipped up!

95
General / Re: Lethn's Programming Questions Thread
« on: August 02, 2013, 05:44:41 am »
I assume you mean that when you press Left, your health doesn't update and the if statement you are referring to is the one below.

if ( sf::Keyboard::isKeyPressed ( sf::Keyboard::Left ) )

    {
        health.setSize ( sf::Vector2f ( 100, 20 ) );
    }


while (window.isOpen())
{

sf::Event event;
while (window.pollEvent(event))
{
 

Your issue is that you can't access the the code once inside the while loop, as it only happens before hand.
In order to fix this, move the if statement to inside the while loop so it gets hit when you make the key press.

96
Graphics / Re: sf::Texture texture;
« on: July 31, 2013, 10:52:51 pm »
    sf::Sprite spr_ButtonNewGame;
    spr_ButtonNewGame.setTexture( img_button );
    spr_ButtonNewGame.setPosition( 0 , 150 );
    spr_ButtonNewGame.setScale( 1.8 , 1 );

    sf::Sprite spr_buttonExitGame;
    spr_ButtonNewGame.setTexture( img_button2 );
    spr_ButtonNewGame.setPosition( 0 , 200 );
    spr_ButtonNewGame.setScale( 1.8 , 1 );

 

The problem is right here, you set the first sprite, create the second sprite, then set the second texture to the first sprite.
Don't Copy and paste ;)

Edit: Words - they got the better of me

97
General / Re: Hello! I'm new to SFML
« on: July 26, 2013, 09:10:38 pm »
I completely agree with eXpl0it3r here. Try your hand at something like pacman, tetris, frogger, snake or any other classic. Get a feel for it and watch yourself get frustrated at even such a small game ;) (we were all there once)

Best of luck to you!

98
Someone else might have a much better answer then me, but from what I'm getting is you need some form of pixel perfect collision?

If I am mistaken there is a sf::sprite::getGlobalBounds that returns a FloatRect for you to use. If this is the case you could very easily compute a collision with the 2 returned rectangles.

Perhaps a little more info might help here :/ but if you are looking for a specific pixel level collision function, that would almost certainly be something you would have to write up yourself

99
General discussions / Re: SFML Game Jam 1 Theme Submission Thread
« on: July 26, 2013, 06:57:11 am »
Transform
Incendiary
Colours

100
SFML projects / Re: Save our chicks!!!
« on: July 26, 2013, 06:43:34 am »
yeah Jump is one of the things left to do.
In the first vid I did jumping by an initial impulse and then adding gravity->multiplicating frametime aso.
That was ugly, as frametime changes HULK jumps on the moon XD
In the 2. vid theres a max humpheight - also ugly :)

I always find real world physics work best, no matter how simple you want to keep things.

What I like to do for jumping in my platformers (if your interested):
    -Set a 'Trajectory' value for jumping - I use a 2D vector for this.
    -Set an 'Air State' and 'Ground State' for the character. This controls whether the character is in the air or not.
    -When a jump action occurs, apply a large value to the characters Trajectory.y (the higher the number the highter the character will jump), then Set the characters State to Air State.
    -In the characters update check if the character is in the Air state, if they are, compute the characters new Trajectory. my normal formula is 9.82m/s^2, which ends up as Trajectory.y += time_passed * gravity; time_passed is the time since my last frame.
    -Then update the characters position based on the trajectory. Location.y += Trajectory.y * time_passed;
    - Once the character collides with the ground, simply set the state back to ground and reset the Trajectory.y back to 0.

This is basically all I ever do and it always turns out great for me. Hope it can help you.

Quick Edit: I should mention that the initial Trajectory.Y would be a negative value (like -200) in this case.

101
SFML projects / Re: Save our chicks!!!
« on: July 25, 2013, 07:58:07 pm »
... but how can hulk jump that high? O_O

The hulk has, numerous times, jumped entire oceans and even into space. There is no end to his strength!

102
Graphics / Re: Handling very huge Tilemaps / images
« on: July 19, 2013, 09:02:40 pm »
What I'm trying to say is you are drawing a lot of tiles. If your map size is 3200x8000 and each tile is 16x16 ( I'm guessing here), that would mean there's 100,000+ tiles that are getting drawn every single frame. I would expect it to run very slow at this point. You need to make less draw calls.

103
Graphics / Re: Drawing in class
« on: July 19, 2013, 07:57:05 pm »
Without seeing what your doing with your classes it's hard to say how you should handle Drawing code in another file. Normally you would have objects in different files (For example, my Entity class is Entity.h and Entity.cpp and my Entity class handles Updating and Drawing all of the entities).

Maybe provide an example of how you are currently handling your classes? It might give us a better idea to help with.

104
Graphics / Re: Handling very huge Tilemaps / images
« on: July 19, 2013, 06:59:40 pm »
o.0 that is a lot of tiles... Can the player see all these tiles are once? or is this the 'zoomed' out version?

If the world is more zoomed in, you are going to want to only draw what the player can see.

105
General / Re: Angle between two vectors
« on: July 19, 2013, 06:46:04 pm »
Quote from: mateandmetal
You need a direction vector (mouse position - player position)
Then normalize that vector (make it a unit vector)
Now, add this normalized vector to your bullet velocity and multiply by the bullet movement speed (a float) and the delta time (as float)

depending on what hes using for a bullet image, he might also need to rotate the image to match that of the player. However this is fairly simple, just use the players current angle at the time of the shot and set your bullet to that.

Pages: 1 ... 5 6 [7] 8 9
anything