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

Pages: [1] 2 3
1
General discussions / Re: SFML Game Jam Submissions!
« on: August 05, 2013, 09:39:41 am »
Here's my submission for the game jam: Shadows and Slithers - a snake clone with a twist

In this game, you play as a fruit-eating snake looking for a late night snack. As you eat more fruit, your vision decreases, leaving you in darkness. You must avoid accidentally eating yourself and you must stay within the screen at all times.

I have not yet added sounds, but I do plan on doing so in the future. I also plan on adding multiplayer support (either on the same computer or online). I may also add different game modes.

Github Link: https://github.com/MassivePotato/SFML_Game_Jam_Submission

Mediafire Link (contains .exe): http://www.mediafire.com/download/jw60lb8lc77c4nm/Shadows_and_Slithers.rar

Resources Used: Gimp (textures), Arial font, my personal SFML libraries, and (of course) SFML.

I don't have any screenshots to share (I have no idea how to embed them in a comment), so I apologize for that.

Please report any bugs, errors, or missing files/assets. Thanks!

2
Graphics / Re: Sprite Animation Speed Ridiculously Fast
« on: July 17, 2013, 11:31:40 pm »
If you'd like an animation class, I have one that is fairly easy to use. You'll need to add two files to your project. The first is located here, https://github.com/MassivePotato/SFML_Extensions/blob/master/FlexibleClock.hpp. You won't actually need to use this class. The second file is located here, https://github.com/MassivePotato/SFML_Extensions/blob/master/Animation.hpp. This class handles all of the functions associated with animating a sprite sheet. If you do decide to use it and have any questions, feel free to ask.

3
Graphics / Re: Sprite Animation Speed Ridiculously Fast
« on: July 17, 2013, 11:10:18 am »
Quote
     
  if(Event.key.code == sf::Keyboard::Escape)
                    window.close();
            }
        }

        source.x++;

        if(source.x * 32 >= pTexture.getSize().x)
            source.x = 0;

Remove the line 'source.x++;' from this code snippet. From a brief look-over of your code, this seems to be the problem. You're advancing the x value every single frame, even though you want to advance it only when enough time has passed for each frame to be noticeable. I haven't actually run your code, so no promises on this fixing your problem, but from what I can tell this is the issue.

4
Graphics / Re: Can't get vertex array to draw when I use a class
« on: June 21, 2013, 11:25:03 pm »
Your issue is one of inheritance. If you look at your declaration of draw, it's private. This means that when you call draw from an object (object.draw(...)), you won't be calling this function. Your draw function needs to be public in order to be called correctly.

As a test, try putting some sort of output statement in the draw function to see if it is actually being called.


Nevermind. I thought you were trying to call test::draw. Sorry  :-[

5
General / Re: Deleting a vector of Shape pointers
« on: June 08, 2013, 06:09:27 am »
Are you allocating new sf::Shapes with new, or are you getting their addresses with the & operator. If you're trying to delete an object that wasn't dynamically allocated (like in the code below), you'll get an error. Hope this helps!

int main()
{
    int c = 0;
    int * p = &c;
    delete p; // Not a valid deletion, since p wasn't dynamically allocated (it contains the address of a static variable)
    return 0;
}

int main()
{
    int * p = new int(0);
    delete p; // Valid, since p was dynamically allocated
    return 0;
}
 

6
Feature requests / Re: Improved Iterator Support for sf::String
« on: June 08, 2013, 02:55:21 am »
Thanks for the quick response! I guess that there are work-arounds for all of these things, so I'll just use those. Thanks again!

7
Feature requests / Improved Iterator Support for sf::String
« on: June 07, 2013, 03:11:27 am »
Would it be possible to implement more support for iterators (as in find, insert, construction, etc.). Additionally, would it be possible to get support for reverse iterators? I looked on the forums and could not find anything about this, so I was wondering if it was already planned or if it would ever be implemented.

8
Window / Re: Error on window declaration
« on: June 02, 2013, 07:08:04 am »
I think that I saw somewhere on the forums that declaring a static window is a bad idea, since it interferes with the global variables used internally by SFML. I could be wrong, but you could try redesigning your program to not rely on a static window.

9
SFML website / Re: New website
« on: May 10, 2013, 07:14:02 pm »
Quote
By default, the sprite is positionned/rotated/scaled relatively to its top-left corner, because it is the local point (0, 0). But if we change the origin to be (5, 5), the sprite will be positionned/rotated/scaled around its center instead.

Positioned is spelled wrong in the documentation on the Transformable class.

10
SFML website / Re: New website
« on: May 08, 2013, 06:40:06 pm »
In the tutorial on Transforms, the word 'positioned' has an extra n.

Quote
By default, entities are positionned relatively to their top-left corner; we'll see later how to change that with the 'origin' property.

11
Graphics / Re: Jumping Rectangle???
« on: April 10, 2013, 11:57:16 pm »
One thing you could do is have a velocity associated with your rectangle. When you press the up key, you could change the velocity's y-value to a negative value (moving up). Then, you can increase the velocity's y-value each frame (to simulate gravity). In code:

// Set up code
//...
// Relevant code
sf::Vector2f velocity(0.f, 0.f); // Positive x = move right, negative y = move up (relative to screen)
sf::Clock timer;
while (someCondition) // Game loop
{
    float timePassed = timer.getElapsedTime().asSeconds();
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) // On key press, change velocity
    {
        velocity = sf::Vector2f(velocity.x, -100.f);
    }
    velocity.y += 9.8f * timePassed;
    rect.move(velocity * timePassed);
    // Do whatever else you need to do
    // ...
}
 

Hopefully this is enough to at least get you started.

12
General / Re: [UNRESOLVED] [GAVE UP] SFML 2.0 Freetype issues
« on: April 09, 2013, 04:05:31 am »
Have you tried using a precompiled version of SFML? Several versions are available here: http://www.mjbshaw.com/p/sfml-nightly-builds.html for Xcode. You might be able to find one that works. I know from personal experience ( :-[) how frustrating it can be to get started with SFML, but there are tons of resources out there to make getting it up and running pretty easy. Hope this helps! :)

13
General / Re: Help!
« on: April 09, 2013, 04:00:09 am »
From what I can tell, nothing appears to be wrong with your controls. You're not using events to get real-time input, so that's not the source of the problem! :D

As far as what your problem is, you'll need to post the rest of your code, since the problem doesn't appear to be coming from your main. A good site for posting code would be www.github.com. You can make a free account there or host your code anonymously here: https://gist.github.com/

Once the remainder of your code is up, the problem should be fairly easy to diagnose and solve!

14
General / Re: Help!
« on: April 08, 2013, 10:11:35 pm »
For one thing, you should be using a while loop to poll your events, not an if-statement. You can check out the documentation for that here: http://sfml-dev.org/documentation/2.0/classsf_1_1Event.php. When you use an if-statement, you'll only be polling a single event out of a set of events that might include more that just one event, instead of polling all of the events per frame.

Also, are you using events to handle your key-presses? It works much more smoothly to use real-time input via the sf::Keyboard class. You can read up on that here: http://sfml-dev.org/documentation/2.0/classsf_1_1Keyboard.php and here: http://sfml-dev.org/tutorials/2.0/window-inputs.php and here: http://sfml-dev.org/tutorials/2.0/window-events.php

As to why you need the event, without event handling you can't close or interact with the window at all. That's why the window gets messed up as you described. The events allow you to interact with the window (minimize, maximize, close, etc.).

Could you also please include the code for "controls.hpp". Since you described your issue as stemming from controlling your sprite, another issue might be present in that code.

15
General / Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« on: December 28, 2012, 07:20:47 pm »
Quote
No. That would trigger runtime errors, not linker errors.

Oh. Okay.  :-[

Pages: [1] 2 3