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.


Topics - Leandro

Pages: [1]
1
SFML projects / Scrolling Shooter
« on: November 19, 2008, 04:27:05 pm »
Hi there guys, I'm working since 3 days ago in this project. It's a basic scrolling shooter like 1942.

I've been having some troubles with the Scale function (for making the deep-sensation, so you can go towards the sky or towards the earth, in 5 different "height levels", and so on you will get 5 different battlegrounds at the same time). Anyway, here's what I've done.

Since my internet conexion sucks, I had to split the actual compressed file into "sections" so that I can upload them easierly.

http://leoostera.googlepages.com/Release_Bin.rar
http://leoostera.googlepages.com/Release_GFX.rar
http://leoostera.googlepages.com/Release_SFX.rar
http://leoostera.googlepages.com/Release_Music.rar

The music of the game was composed by me, transcribed to Guitar Pro, exported to WAV and then converted to Ogg with Audacity. And the effects were recorded with a microphone and Audacity.

The sprites were taken from Rayden, although I modified them a bit to add the "turbo" and "slowdown" thing. Lastly, I made the bullet and the mouse sprite myself  :roll: ...yeah, they suck :P

Ok. Controls are WASD for moving left, right, forward and backward. Left click shots.

I will implement mouse aiming limited by angles for the cannons and a "sniper" system so that you can aim with both cannons to the same place at the time.

Also I'm trying to figure out how does Scale function work so that I can make that "height level" sensation/effect.

Well, thanks for everything. Any feedback is welcomed :D

2
Window / Best way to get smooth input
« on: November 16, 2008, 08:05:09 pm »
HI there guys, it's the first time I use this API. I come from SDL (3 years, ppff, lotta time) and got bored of doing "low-level" stuff...(not really low, but lower than this for sure).

It's been no more than 12 hours since I've installed SFML and I'm making a Scrolling Shooter, and this API is damn easy to use...I got used really fast. If you aimed that L, then two thumbs up for you  :D

Ok, right to the question:

I ran a while loop with the GetEvent(mEvent) thing, "similar" to SDL's way

Code: [Select]

    while (mApp.GetEvent(mEvent))
        {
        if ((mEvent.Type == sf::Event::Closed) || ( (mEvent.Type == sf::Event::KeyPressed) && (mEvent.Key.Code == sf::Key::Escape) ) )
            Quit();

        //Step functions calls
        mPlayer.Step(mEvent);

        //Drawing stuff
        mApp.Draw(mPlayer.Get());

        mApp.Display();
        }


As you can see, the Step method of the mPlayer instance (actually it's a "Player" class instance) asks for a mEvent.  The Step source is right below:

Code: [Select]

//LEFT
if ( (Ev.Type==sf::Event::KeyPressed)  && (Ev.Key.Code == sf::Key::A) )
    {
    mCurrentImg = 1;
    mMotionX = -5.0f;
    }

//RIGHT
else if ( (Ev.Type==sf::Event::KeyPressed)  && (Ev.Key.Code == sf::Key::D))
    {
    mCurrentImg = 2;
    mMotionX = 5.0f;
    }

//DOWN
else if ( (Ev.Type==sf::Event::KeyPressed)  && (Ev.Key.Code == sf::Key::S) )
    {
    mMotionY = -1.0f;
    }

//UP
else if ( (Ev.Type==sf::Event::KeyPressed)  && (Ev.Key.Code == sf::Key::W))
    {
    mMotionY = 2.5f;
    }
else
    {
    mCurrentImg = 0;
    mMotionX = 0.0f;
    mMotionY = 0.0f;
    mScaleFactor = 0.0f;
    }

mSprite.Move(mMotionX,mMotionY);
mSprite.Scale(mScaleFactor,mScaleFactor);


But the movement I get is not "smooth". By "smooth" I mean that once you press the key you have to wait for less than a second for the Sprite to start moving and you can't just get a nice bidirectional movement when you press A and W or A and S and so on...

So my question is what the heck I'm doing wrong that doesnt let me get that smooth, nice and sweet movement I'm trying to get?

Thanks beforehand

L

PD: Nevermind the Sprite.Scale & mCurrentImg things, I am planning to do some multidirectional-like effect...and I will upload progress =)

Pages: [1]