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

Pages: 1 ... 5 6 [7]
General / Problem with sequencing events
« on: January 07, 2012, 04:07:00 pm »
Hey, for part of my game, I will be making a story part, and an rpg part. For the story part, i've designed it so that text will be displayed using a typewriter effect, you wait for that to stop, wait something like 5 seconds then it clears that and goes onto the next string. Well, i've tried while loops, do loops, if statements and even switches, but it's not working.

The closest i've come to it actually working is with while loops, this is an example of the closest i've come to making it work:

Code: [Select]

while (progress == 0)
    if (timer.GetElapsedTime() > 0.01 && character < str.length())
                text.SetText( str.substr(0, character) ) ;


            if (character == str.length())
                    progress = 1;

That piece of code will go through the string (str) and display it letter by letter, and this works. To then get it out of the loop, I then put an if statement to know when it's finished and put progress to 1, to make it get out of the loop, and then carry on with another while loop where it will be "while (progress == 1)".

The thing is, it stops all together after progress = 1 and doesn't exit the loop. To make sure that it did actually make progress 1, i did this:

Code: [Select]

if (character == str.length())
                    std::cout << "Test";
                    progress = 1;
                    std::cout << progress;

and it actually put test, and 1 to the console but just stopped dead :/

If anyone could tell me what I'm doing wrong, or come up with another way round it, i'd be thrilled!

When i've made this, I'll be submitting it to the forums, with the source code, as other people's source code has really helped me learn, and i wanna give back to the community :)


Graphics / Rainfall
« on: January 07, 2012, 03:40:57 pm »
Couldn't really understand the particle system, and it wouldn't compile anyway :/ I would try doing a sprite and moving it, but I wouldn't know how to, looked at sparks, pretty complex, but going to take a look at Thor now

Graphics / Rainfall
« on: January 05, 2012, 01:44:01 am »
Cheers for the replies :) Ill post back tomorrow with what i've got, gunna look at particle emitters tonight

Graphics / Rainfall
« on: January 05, 2012, 12:28:54 am »
Hey, for my game's main menu, i've been trying to find out how i could simulate rainfall, either with little sprites or even just drawing lines. After a lot of searching and experimenting (newbie here) i couldn't come up with anything.

Here's how it would be wanted (http://www.youtube.com/watch?v=2EJxlkTJ1nE&feature=related)

I'd like to ask how I could implement this, and any source code would be greatly appreciated :)


Graphics / Main Menu selection
« on: December 29, 2011, 03:16:06 pm »
I figured it would have something to do with mouse position, but I don't really know how to code that :s

Graphics / Main Menu selection
« on: December 28, 2011, 09:36:00 pm »
Hey again, would anyone know how to show a sprite when the mouse is over a certain piece of the screen, like text for example. After that I'll then do a click function to then launch different parts of the game.

Here is my code at the moment, and I have been trying to get it so it automatically comes up with the selection sprite one the first option and then it will be moved by pressing up and down.

Code: [Select]
#include <SFML/Graphics.hpp>

int main()
    // Create main window
    sf::RenderWindow App(sf::VideoMode(1024, 600), "Before the rain");

    // Load a font from a file
    sf::Font MyFont;
    if (!MyFont.LoadFromFile("cinnamon_cake/cinnamon cake.ttf", 50))
        return EXIT_FAILURE;

    // Load the sprite image from a file
    sf::Image selection;
    if (!selection.LoadFromFile("selection.tga"))
        return EXIT_FAILURE;

    // Create the sprite
    sf::Sprite Sprite(selection);

    // Change its properties
    // Sprite.SetColor(sf::Color(0, 255, 255, 128));
    // Sprite.SetPosition(200.f, 100.f);
    Sprite.SetScale(2.f, 2.f);

    // Create a graphical string
    sf::String start;
    start.SetText("Start Game");
    start.SetColor(sf::Color(0, 128, 128));
    start.SetPosition(50.f, 300.f);

    sf::String options;
    options.SetColor(sf::Color(0, 128, 128));
    options.SetPosition(50.f, 350.f);

    sf::String credits;
    credits.SetColor(sf::Color(0, 128, 128));
    credits.SetPosition(50.f, 400.f);

    sf::String exit;
    exit.SetColor(sf::Color(0, 128, 128));
    exit.SetPosition(50.f, 450.f);

    sf::String title;
    title.SetText("Before The Rain");
    title.SetColor(sf::Color(0, 128, 128));
    title.SetPosition(75.f, 100.f);

    // Start game loop
    while (App.IsOpened())
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
            // Close window : exit
            if (Event.Type == sf::Event::Closed)

        // Make the second string rotate
        // Bonjour.Rotate(App.GetFrameTime() * 100.f);

        // Clear screen

        // Draw our strings


    return EXIT_SUCCESS;

Either way would REALLY help me out, if someone could supply any source code to do this. Sorry about all the questions, but I'm new and there aren't many tutorials out there for what I need :(

Many thanks, i'll be back on tomorrow!

aBallofWin :)[/code]

Graphics / Scrolling Text (Final Fantasy Like)
« on: December 28, 2011, 09:29:22 pm »
Quote from: "julen26"
Something like that was answered here http://sfml-dev.org/forum/viewtopic.php?t=6490

Ah that's even better haha, cheers!!!

Graphics / Scrolling Text (Final Fantasy Like)
« on: December 28, 2011, 12:07:42 pm »
Cheers for the replies :) I'll just have to experiment around with that


Graphics / Scrolling Text (Final Fantasy Like)
« on: December 28, 2011, 01:31:34 am »
Hey, I'm new to SFML, and so far it's awesome, but I need a little help. I'm creating a little RPG, and I'd like to know how I could implement text that appears one word after another, much like in Final Fantasy games. (http://www.youtube.com/watch?v=m9kYCV7X4wA skip to 5 minutes in and you'll see what I mean).

I wouldn't have the faintest clue on how to even start to do this :s and any help would be greatly appreciated!



Pages: 1 ... 5 6 [7]