Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Tanks !  (Read 9525 times)

0 Members and 1 Guest are viewing this topic.

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Tanks !
« Reply #15 on: May 27, 2014, 11:52:49 pm »
there's a bug with health points z-index.

bodies are described as follow (from physics.xml) :

<physics>
        <world gravity="0.0"/>
        <body name="shell" type="dynamic">
                <fixture density="0.5" friction="0.3" restitution="0.5">
                        <shape type="box">
                                <point x="7.0" y="2.0"/>
                        </shape>
                </fixture>
        </body>
</physics>

for the moment only "boxes" shapes are supported, but i will probably add polygon and circle shaped bodies.

body defs are loaded in memory and reused when needed by their name.


« Last Edit: May 27, 2014, 11:55:56 pm by dwarfman78 »
@dwarfman78
github.com/dwarfman78

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Tanks !
« Reply #16 on: May 29, 2014, 10:18:38 am »
New release : https://github.com/dwarfman78/tanks/releases/tag/v1.0.0

I'm going to use github for binaries distribution instead of my personal server.

Added blast from explosion (sprite and physics).
Changed ttf for text to a military styled font.
Bug correction (hp displaying is back to normal)
@dwarfman78
github.com/dwarfman78

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Tanks !
« Reply #17 on: May 31, 2014, 10:48:28 am »
There is a bug with sound effects in general, i did not take into account the fact that there is a limited number of sf::Sound instances that can be in a program at the same time, so i guess i'll have to implement some sort of "sound pool" to manage sf::Sound usage.
@dwarfman78
github.com/dwarfman78

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Tanks !
« Reply #18 on: June 23, 2014, 10:13:04 pm »
I'm currently doing some tests in order to add scripting capabilities to the game (or even maybe the engine) throught chaiscript (http://chaiscript.com/).

for the moment bullet behavior is defined at compile time :

void Bullet::renderLogic()
{
    if(!collision())
    {
        sf::Vector3f pos = myEntity->getPosition();

        myEntity->setPosition(pos.x+(speed.x*(myInterpolation)),
                             pos.y+(speed.y*(myInterpolation)));
    }
    else
    {
        unregister();
    }
}

But now i'm able to write :

void Bullet::renderLogic()
{
    chai.eval_file("bullet.chai");
}

And edit the bullet.chai as follow :

if(!this.collision())
{
        myEntity.setPosition(posX+(speedX*(myInterpolation)),
                             posY+(speedY*(myInterpolation)));
}
else
{
        this.unregister();
}

Providing the binding information :

    chai.add(chaiscript::var(this),"this");
    chai.add(chaiscript::fun(&Bullet::collision),"collision");
    chai.add(chaiscript::var(myEntity),"myEntity");
    chai.add(chaiscript::var(&myInterpolation),"myInterpolation");
    chai.add(chaiscript::fun(&se::Entity::setPosition),"setPosition");
    chai.add(chaiscript::var(&speed.x),"speedX");
    chai.add(chaiscript::var(&speed.y),"speedY");
    chai.add(chaiscript::fun(&se::Entity::getPosition),"getPosition");
    chai.add(chaiscript::var(&myEntity->getPosition().x),"posX");
    chai.add(chaiscript::var(&myEntity->getPosition().y),"posY");
    chai.add(chaiscript::fun<void (Bullet::*) ()>(&Bullet::unregister),"unregister");
@dwarfman78
github.com/dwarfman78