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

Pages: 1 ... 16 17 [18] 19
256
SFML projects / Re: Space Invaders Clone
« on: September 28, 2015, 01:56:46 pm »
update

- fixed the bug where invaders some time drop down, especially when it got hit at both edges right and left of screen
- Spaceship is become so hard to maintain, so that, it splitted into 3 classes Boss, Invaders and Player.
- old Player class renamed to PlayerController.


still damn bug is there. if you play long enough in the game the block of invaders SOME TIME drop down with no obvious reason why is that happen. it's hard to track down this kind of bugs to know whats really cause it and my compiler doesn't help me so much here.

257
SFML projects / Re: Space Invaders Clone
« on: September 26, 2015, 06:20:57 pm »
update

i add a new video in main post for implement a new movement algorithm for invaders. result seems okay so far. inspired by what Hapax did  to his latest practice games. thanks millions Hapax

here code snippet of adapt enemy movements
void World::adaptEnemyMovements()
{
        bool changeDirection = false;

        for (const auto& i : mEnemyNodes)
        {
                Spaceship& enemy = static_cast<Spaceship&>(*i);

                if (enemy.getType() == Spaceship::Boss)
                        continue;

                if (!getBattlefieldBounds().contains(enemy.getPosition()))
                        changeDirection = true;
        }

        // let invaders moving down and update condition of change direction
        for (const auto& i : mEnemyNodes)
        {
                Spaceship& enemy = static_cast<Spaceship&>(*i);

                if (enemy.getType() == Spaceship::Boss)
                        continue;

                enemy.requestChangeDirection(changeDirection);
        }
}

and here update movement pattern it's exactly same mostly
void Spaceship::updateMovementPattern(sf::Time dt)
{
        // Enemy Spaceships: Movement pattern
        const std::vector<Direction>& directions = Table[mType].directions;

        if (!directions.empty())
        {
                // Moved long enough in horizontal direction: Change direction to move down
                if(mChaneDirction && directions[mDirectionIndex].distance == 0.f)
                {
                        mDirectionIndex = (mDirectionIndex + 1) % directions.size();
                        mTravelledDistance = 0.f;
                        mChaneDirction = false;
                }

                // Moved long enough in vertical direction: Change direction to move aside
                if (directions[mDirectionIndex].distance != 0.f && mTravelledDistance > directions[mDirectionIndex].distance)
                {
                        mDirectionIndex = (mDirectionIndex + 1) % directions.size();
                        mTravelledDistance = 0.f;
                }

                // Compute velocity from direction
                auto radians = toRadian(directions[mDirectionIndex].angle + 90.f);
                auto vx = getMaxSpeed() * std::cos(radians);
                auto vy = getMaxSpeed() * std::sin(radians);

                setVelocity(vx, vy);

                mTravelledDistance += getMaxSpeed() * dt.asSeconds();

                applyAnimation(dt);
        }
}



unfortunately, there is a bug, invaders some time drop down, especially when it got hit at both edges right and left of screen.




258
SFML projects / Re: My Practice Beginner Games
« on: September 25, 2015, 04:35:23 pm »
i have downloaded MTD last night, also, i made static library for Plinth, Kairos and DEV. and i linked them with MTD, it works beautifully in my machine.

after spending some time with those library i realized that i took a lot of effort and time to accomplish that. i would really thank you for that. i'm now studying and working out on this game too. ;)

sorry i forget to say that i got warning when i compile Plinth

(click to show/hide)

259
SFML projects / Re: Space Invaders Clone
« on: September 25, 2015, 04:25:00 pm »
Quote
Ah, this is the Space Invaders clone you were talking about!
yup, this is my first graphics game. ;D

Quote
In the 'new' one, it's evident that when a side of the group of invaders is removed, the remaining invaders don't continue to the edge of the screen; they move as if the entire group is still present.
yes, this is due to that every invader ship moves independently by fixing distance. to change that it needs to be considered in early stage. for this game, it needs to re-write whole game structure which i don't like, it's better to start by using different game structure.

Quote
Not sure why the "mission" was "successful" either
hahaha, yeah you are right.. it seems i should die but fortunately i had 2 lives when that ship collided with me, i just lost one live but i won  :P

Quote
I also find it weird that when you die, you just animate death but carry on as normal
the original game perform death animation when the player got hit. i just mimic the original game.

Quote
Keep it up. Looking forward to seeing the final result
thanks alot sir.

260
SFML projects / Re:creation - a top down action rpg about undeads
« on: September 24, 2015, 09:53:20 am »
i just did quick scan for your older posts and i found that you are making graphic arts and coding but in last posts you're also, making music composing. that indeed impressive. to be honest with you, i can't do that no way, it needs super talent guy like you to accomplish that, ain't me, i'm just average guy who's barely can coding in c++ mostly copy and paste from others. ;D

me too My hat comes off for you sir.

it seems this game is well written and best to learn from. i have question are you going to make this game open source?

261
SFML projects / Re: My Practice Beginner Games
« on: September 22, 2015, 11:42:35 am »
i found time this morning to test Plinth. it seems work fine here. i used VS 2015 and SFML2.3.1-RCx32 night built but i haven't tested rest of library yet only Anchor::Local headers file. i will tell you if i had any problems later with Plinth or Kairos.  :)

262
SFML projects / Re: Space Invaders Clone
« on: September 22, 2015, 08:21:27 am »
i added new video for latest update, after implemented sprite masking and pixel collision detection.

here snippet from sprite masking by using sf::RenderTexture and sf::Image

void Shield::updateCurrent(sf::Time dt, CommandQueue& commands)
{
        if (!mOnHit)
                return;

        mRenderTexture.clear();

        mRenderTexture.draw(*this, sf::BlendNone);
        mRenderTexture.display();

        float radius = (mRectOnHit.height > ExplosionRadius) ? mRectOnHit.height : ExplosionRadius;
        sf::CircleShape circle(radius, 10);
        circle.setPosition(mPositionOnHit.x, mPositionOnHit.y + circle.getRadius() / 2.f * mSign);
        circle.setFillColor(sf::Color::Transparent);
        centerOrigin(circle);

        mRenderTexture.draw(circle, sf::BlendNone);
        mRenderTexture.display();

        sf::Vector2u position(static_cast<std::size_t>(getPosition().x - mTexture.getSize().x / 2u), static_cast<std::size_t>(getPosition().y - mTexture.getSize().y / 2u));
        mImage.copy(mRenderTexture.getTexture().copyToImage(), 0u, 0u, sf::IntRect(position.x, position.y, mTexture.getSize().x, mTexture.getSize().y));
        mImage.createMaskFromColor(sf::Color::Transparent);

        updateSprite();
}

and here the pixel collision detection for bullets:

bool PixelcollidesPair(const Shield& shield, const Projectile& bullet)
{
        auto bulletBounds = static_cast<sf::Rect<std::size_t>>(bullet.getBoundingRect());
        auto shieldBounds = static_cast<sf::Rect<std::size_t>>(shield.getBoundingRect());

        auto width = bulletBounds.left + bulletBounds.width;
        auto height = bulletBounds.top + bulletBounds.height;

        sf::Vector2u position(bulletBounds.left, bulletBounds.top);

        if (!bulletBounds.intersects(shieldBounds))
                return false;

        for (auto x = position.x; x < width; ++x)
        {
                for (auto y = position.y; y < height; ++y)
                {
                        auto relX = x - shieldBounds.left;

                        auto relY = (bullet.getCategory() & Category::PlayerProjectile) ? y - shieldBounds.top : y - shieldBounds.top - bulletBounds.height;

                        if (shield.getPixel(relX, relY))
                                return true;
                }
        }

        return false;
}

263
SFML projects / Re: Space Invaders Clone
« on: September 20, 2015, 07:41:41 pm »
update

after reading an old post http://en.sfml-dev.org/forums/index.php?topic=7427.0 about Sprite Masking by using sf::RenderTexture and sf::Image.

 i implemented them in the game, now the game use single texture for shield and result some how acceptable.

264
SFML projects / Re: My Practice Beginner Games
« on: September 16, 2015, 01:05:23 pm »
me too i vote for space invaders, it is easy and fun,
btw, i really like your mini-libs it's awesome. i will use them in my next game ;)

265
SFML projects / Re: Space Invaders Clone
« on: September 02, 2015, 09:30:59 pm »
yeah, i test the ts=1 with my IDE for functions, it looks nice especially when it has description comments. i'm going to use this style in next game  ;)

266
SFML projects / Re: Space Invaders Clone
« on: September 02, 2015, 09:03:50 pm »
If you use tabs for spacing, code on github starts looking a little bit ugly
http://stackoverflow.com/a/23522945

They've finally recognized that not everybody is using spaces... ::)

thanks Nexus,

267
SFML projects / Re: Space Invaders Clone
« on: September 02, 2015, 07:22:19 pm »
UPDATE:

i have re-written QuadTree class. now, the game seems work fine in debug mode. i would like to know, how to get maximum efficiency from QuadTree. i know it can be done by storing the objects in leaves only. i have tried to achieve that, and somehow i managed to store objects in leaves as possible. but i'm not sure whether or not i did it correctly this time.

thanks in advance.

268
SFML projects / Re: Space Invaders Clone
« on: August 29, 2015, 04:25:52 pm »
hi Brax

sorry for what you had through, probably i should mention that in main post.

yes indeed thats why i installed VS 2015 since i realized, VS 2013 which i had, it has a bug with std::bind. but i regretted for installing VS 2015. most of third party libraries such lua and glew even current SFML need to recompile once again to fit VS 2015. special thanks to@eXpl0it3r for his night build for SFML. personally i don't know how to build those libraries by my own yet.

quick fix you may convert those error std::binds to lambda expressions

269
SFML projects / Re: Space Invaders Clone
« on: August 28, 2015, 09:35:30 pm »
thanks SeriousITGuy

nice to hear that you were back to practice games keep it up. indeed space invaders has tobe in your list. it easy to made and also fun. i have made it earlier but with ascii text-base. this is my first graphics game :-[

btw, @Hapax is doing his practice games nowadays, whats that a coincidence  ???. i have looked to his practice game, he made awesome mini-libs, really it's worth looking at.

270
SFML projects / Re: Space Invaders Clone
« on: August 21, 2015, 02:41:58 pm »
That's nice. I've dowloaded it :)

thanks good to hear that  :)

Pages: 1 ... 16 17 [18] 19