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

Pages: [1]
1
General / Re: AW: Re: Collsion with multiple bullets and multiple enemies
« on: September 13, 2014, 10:59:10 pm »
You might want to refresh your knowledge of C++ functions, especially what the keyword "return" does.

Yea thank you for that tip! Read up some about functions and so on, and yea.. When return is called the whole function is stopped. But haven't really found out much else on how to solve my problem. But I hope you can answer one more question from me! :D

From your experience, is it possible to use three classes, a bullet, invader and collision class, in which the bullet and the invader class use vectors to create and delete bullets and invaders. And make collision between them happen? If it is possible I will keep trying till I succeed! :)

(hope you understood my very messed up question)

2
General / Collsion with multiple bullets and multiple enemies
« on: September 13, 2014, 01:22:40 pm »
Hello! I'm trying to do a simple shoot 'em up game, but I've run into a problem.

What I'm trying to do is collision between bullets and enemies (invaders). With one bullet class, one invader class and one Collision class. I've gotten the collision to "kind of" work, meaning that one bullet can kill invaders, the problem I'm facing right now is, how do you make it so all the bullets can hit the invaders? I've tried returning a reference to the bullet vector, a pointer to the vector, the vector, the sprites in the vector and so on. I have identified the error in the code below, the problem is that the i value dosen't increase when I return the sprite.

Here's some example code.


Bullet.cpp

sf::Sprite Bullet::BulletPosition(){

        for (int i = 0; i < bullets_straight.size(); ++i){

                return bullets_straight[i];
        }
}

Collision.cpp

bool Collision::SpriteCollision(sf::Sprite _sprite1, sf::Sprite _sprite2){

        if (_sprite1.getPosition().x > _sprite2.getPosition().x || _sprite1.getPosition().x +8 < _sprite2.getPosition().x - 32
                || _sprite1.getPosition().y > _sprite2.getPosition().y + 32 || _sprite1.getPosition().y < _sprite2.getPosition().y - 32){
                return false;
        }
}

Invader.cpp

for (int i = 0; i < invaders.size(); ++i){


                if (SpriteCollision(invaders[i], _sprite)){
                        invaders.erase(invaders.begin() + i);
                        check_direction.erase(check_direction.begin() + i);
                }



        }
}

I  will make the collision better later on but right now I just, want to get it working.

3
Audio / Re: Static Audio Linker errors
« on: June 15, 2014, 12:58:36 pm »
"Cannot open" basically means it can't be found. So make sure you provide the path to where all the lib files are.

Okay I readded everything and now it's working perfectly thank you for your help! It has been much appreciated!

4
Audio / Re: Static Audio Linker errors
« on: June 14, 2014, 06:46:12 pm »
You can find some information about static linking past SFML 2.1 on the wiki. Meaning you have to link all the dependencies.

Are you by chance tim0n who made a Firefall hack? :P

Oh thank you for that! It seems to work now, however I'm getting a new error "LINK : fatal error LNK1104: cannot open file 'sfml-system.lib'" do you by any chance know what the problem might be here?

I added this to my code:

#pragma comment(lib, "openal32.lib")
#pragma comment(lib, "sndfile.lib")
#pragma comment(lib, "sfml-system.lib")

And I'm unfortunately not that Tim0n, we just happen to use the same name, I began using Tim0n back in 2009 so it's not because I'm some kind of "wannabe" ;)

Edit: Idiot question, I shouldn't have included sfml-system.lib because I've already included it, so now debug static is working, but my release static says "1>LINK : fatal error LNK1181: cannot open input file 'sfml-graphics-s.lib'" Which is weird, because I have used release static before.

5
Audio / Static Audio Linker errors
« on: June 14, 2014, 05:55:37 pm »
Hello I'm trying to build a static project but I believe that I have included both the SFML_STATIC and sfml-audio-s.lib correctly (it is working when I'm not using sf::sound or sf::soundbuffer) but when I try to run it with sound it gives me alot of linker errors (see below) I'm using SFML 2.1 and Visual Studios 2013 and this template: http://en.sfml-dev.org/forums/index.php?topic=13010.0

Release static:
(click to show/hide)

Debug Static:
(click to show/hide)

Does anyone know what I am doing wrong? I've read somewhere that linking has changed in SFML 2.1 but haven't found what it changed to.

I also have another bug, when I'm trying to exit my normal release and debug versions I get "Unhandled exception at 0x7719A4B9 (ole32.dll) in Pong.exe: 0xC0000005: Access violation reading location 0xFEEEFEEE." Does anyone know how to solve this as well?

I hope I have given enough information but am prepared to give more in case I've missed something.

Thanks!

Pages: [1]
anything