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

Pages: [1]
1
SFML projects / Scrolling Shooter
« on: November 23, 2008, 12:17:46 am »
Hi there guys,

Thanks for the feedback.

I've tried the "game" in many computers and the Window just doesn't show unless you Maximize it from the windows Task bar it won't show. And once maximized, the game looks weird (Window Height and Width are modified by then)

I don't really know what's the problem behind this, but here is how I initializate SFML Window RenderWindow:

Code: [Select]
mApp.Create(sf::VideoMode(800,800,32),"ScrollingShooter");//,sf::Style::Fullscreen);
mApp.ShowMouseCursor(false);
mApp.EnableKeyRepeat(false);
mApp.SetFramerateLimit(30);


I don't do any destruction, resizing nor something else but drawing in the screen with this mApp (sf::RenderWindow mApp;) and doind mApp.Close() at the deconstructor of the Game class (where it is member of).

Any ideas?

By the way, if you update with http://leoostera.googlepages.com/NewBin.rar you can now aim with the mouse from 30° to -30° :D

2
Graphics / normalize vector
« on: November 20, 2008, 07:33:53 pm »
hi there,

I was wondering, how should I multiply that vector so that I can use it to control de direction?

can I do something like this:

           
Code: [Select]
m_Bullets[i].Direction.x = m_Bullets[i].Speed * Sprite_Mouse.x ;
            m_Bullets[i].Direction.y = m_Bullets[i].Speed * Sprite_Mouse.y ;


The fact is that my angle is reduced from 30.0f to -30.0f (ergo, 330.0f, but counting backwards to zero and then from 360.0f to 330.0f) but doing that makes my bullets go always in the same X direction...

I tried doing something like:

Code: [Select]
m_Bullets[i].Direction.x = ( (angle>180.f || angle<0.0f)  ?m_Bullets[i].Speed : -m_Bullets[i].Speed ) * Sprite_Mouse.x ;

But it just doesnt work =/...meaning, angle is a var that actually works great that goes from 30.0f to 330.0f backwards.

Any ideas?

3
SFML projects / Scrolling Shooter
« on: November 20, 2008, 01:27:38 am »
Well, after some time thinking and trying I got the scaling-depth-up&down-effect I was trying to code.

The new binary can be download from here:

http://leoostera.googlepages.com/Release_NewBin.rar

It's more like a patch :P...but if someone just wants to check how it works instead of downloading everything just get the Release_NewBin and the Release_GFX...it requires all but sfml-network dll that well, i suppose you all have.

The keys are Left Control for going down and Left Shift for going up.

Any feedback is welcomed  :D

4
SFML projects / Would be fine if...
« on: November 20, 2008, 01:23:40 am »
Well, I think that you should try something like this (psuedo-code):

if placeFree(Object1.X position + movementFactorX, Object1.Y position + movementFactorY)...

placeFree would certainly ask for a Rect and not for a Vector (point), but I think that you may get the idea, tho

let's say

Code: [Select]
bool PlaceFree(const sf::Rect& o_Rect)
{
if there is any object (INTERFACE NEEDED?) in the area of this Rect return false
else return true
}


Hope it was helpful

5
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

6
Window / Best way to get smooth input
« on: November 17, 2008, 03:04:54 am »
Point taken.

Yep, I just double checked it with some SDL stuff and there was the problem.

So, the source code should be like this:

Main loop
Code: [Select]
   //Event parsing
    while(mApp.GetEvent(mEvent))
        {
        //EVENT STUFF
        }
    //Some things that need to be done every cycle
    mMouseSprite.SetPosition(mApp.GetInput().GetMouseX(),mApp.GetInput().GetMouseX());

    //Step functions calls (basically the game logic)
    mPlayer.Step(mApp);

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

    mApp.Display();


And in wherever you need to use the IsKeyDown thing I am asking for a sf::RenderWindow& and that's all:
Code: [Select]

void Player::Step(sf::RenderWindow& App)
{
bool KA = App.GetInput().IsKeyDown(sf::Key::A);
bool KD = App.GetInput().IsKeyDown(sf::Key::D);
//...and so on


Well, I think this problem is solved. And where I got my moving smothness in movement maybe someone else will get an answer.

Thanks Imbue  :D

7
Window / Best way to get smooth input
« on: November 17, 2008, 02:23:07 am »
Thanks for the answer

What I was doing after using KeyPressed was just what you did, but got the same laggy result. However, if I comment the while thing in the GetEvent part (meaning, calling GetEvent just one time per loop cycle) there IS SMOOTHNESS IN THE MOVEMENT (not yelling, but emphasising)

The thing is that I'm not pretty sure how will this make other game input react like.

As I am moving on with this I will probably have more input issues, but anyway...I'll stick to the smoothness by now.

Thanks Imbue  :)

PD: By the way, yes, I love reading technical documents or API documentation such as the tutorials you mentioned (which I've already read).

8
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]