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 - The Terminator

Pages: 1 ... 11 12 [13] 14 15
181
SFML projects / Survive and Thrive
« on: November 06, 2012, 03:02:46 am »
Intro:
Hello all, I'm here to introduce one of my big projects called Survive and Thrive. Survive and Thrive is a 2D zombie game that is based on waves. Every wave zombies are spawned in increments depending on the wave. The objective of the game is to survive and thrive  :P. You must kill zombies in order to gain cash to further advance your character.

When are updates coming?
Updates will be shoveled out depending on how much time I have. Expect to see more updates during the weekend than the week. (high school for you)

Shout outs:
A huge shout out to eXpl0it3r as I use some of his code for the state engine.

Conclusion:
Anyways, thanks for looking at my up and coming project! I welcome CONSTRUCTIVE criticism and bug reports. A heads up for the people who download this version, it's only v0.1 so most of the main menu doesn't work. (yet) If you are interested in becoming a part in this project, message me as I need an artist for sprites and images. Thanks once again for reading!

Download Link:
http://www.mediafire.com/?z8wzlptuj1js5kz

182
Graphics / Re: Trouble detecting sprite's global position
« on: November 06, 2012, 12:01:36 am »
Nevermind! Got it to work using sf::Event::MouseMoved. Thanks for the help though FRex!

183
Graphics / Re: Trouble detecting sprite's global position
« on: November 05, 2012, 11:54:51 pm »
Ok, now changing the states work. I still can't get changing the sprites to work though.

184
Graphics / Trouble detecting sprite's global position
« on: November 05, 2012, 11:32:09 pm »
Hi there, I'm having some difficulties trying to detect if the mouse is hovered over and clicking on the sprite. I want it to change sprites once it's hovered over, then change states once it is clicked on. The only thing I'm having trouble on is the mouse. Here's my code that compiles but doesn't seem to work:

void IntroState::update() {
    sf::Event event;

        while(m_game.screen.pollEvent(event)) {
                switch(event.type) {
            case sf::Event::Closed:
                m_game.quit();
                break;

            case sf::Event::KeyPressed:
                switch (event.key.code)
                {
                    case sf::Keyboard::Escape:
                    m_game.quit();

                    break;
                }

                break;

            break;

            case sf::Event::MouseButtonPressed:
                if (s_playButton.getGlobalBounds().contains(sf::Mouse::getPosition().x, sf::Mouse::getPosition().y))
                {
                    m_game.screen.draw(s_playButtonActive); //replace current button with a highlighted one since it is being hovered over

                    if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) // if the playbutton is being hovered over AND the left mouse button is being clicked
                    {
                        //do stuff
                    }
                }

                break;
                }
        }
}

I appreciate any help. Thanks!

185
General / What would be most efficient?
« on: October 19, 2012, 07:52:00 pm »
I'm creating some tilemap support for my engine, and I can't really decide which two ways to go about it. Here's two ways I thought of: (P.S. I plan to load the tilemap from an external file such as a .txt)

1:
Each tilemap would be represented as a child class that would be derived from a base class called TileMap. To draw this tilemap when the character does something such as reaches the edge of the map, you would pass a reference to the object of the child class and it would draw that specific class. A camera would not be needed as the certain tilemap would be seen as a whole on the screen.

2:
Have 1 huge tilemap that periodically draws itself when the character moves in a certain direction. Once the character has reached the edge, it will collide and stop. A camera will be needed because the tilemap would need to scroll in the direction that the character is moving. There would only be one class called TileMap with methods such as void drawMap(), etc.

It would be helpful for some advice to pursue this task. Thanks in advance!

186
Audio / Re: Music won't work at all
« on: September 24, 2012, 01:08:28 am »
Just tested, it loads correctly, but still won't play the sound. Very frustrating.

187
Audio / Re: Music won't work at all
« on: September 23, 2012, 10:58:06 pm »
Yes, I tried with .mp3, it worked in Media player, but not with SFML :(

188
Audio / Re: Music won't work at all
« on: September 23, 2012, 10:47:23 pm »
Yes, I tested it out the file with Windows Media Player and the sound file worked fine.

189
Audio / Music won't work at all
« on: September 23, 2012, 10:40:26 pm »
Hi, on my game the sf::Music class doesn't seem to be working at all. I get no errors, and my path to the file is correct, but no music is being played. Here's some of my code:

//Main music
sf::Music m_mainMusic;

//Load mainMusic into memory and set some propertie    
m_mainMusic.openFromFile("Resources/japanesemusic.ogg");    
m_mainMusic.setVolume(50);  
m_mainMusic.setLoop(true);    
m_mainMusic.play();

It won't work at all, and I tried using sf::Sound and soundbuffer as well and they didn't work either. Any suggestions?

190
General / Re: Problems with Entity Manager using std::unique_ptr
« on: August 23, 2012, 02:20:14 am »
Thanks, I passed by rvalue and it works perfectly! I learned something new today, never having used rvalues before :P

191
General / Problems with Entity Manager using std::unique_ptr
« on: August 22, 2012, 10:59:24 pm »
Ok, I'm trying to create an entity manager for my engine, and I'm encountering a problem that I can't seem to figure out. Here's my code for EntityManager.hpp:

#ifndef ENTITYMANAGER_H
#define ENTITYMANAGER_H

#include <memory>
#include <vector>

class Entity;

class EntityManager {
public:
    void createEntity(std::unique_ptr<Entity>);
    void destroyEntity(std::unique_ptr<Entity>);
    void destroyAllEntities() { entities.clear(); }

private:
    std::vector<std::unique_ptr<Entity> > entities;
};

#endif // ENTITYMANAGER_H

And it's corresponding cpp file:

#include <memory>
#include <vector>
#include <algorithm>
#include <iostream>

#include "EntityManager.hpp"
#include "Entity.hpp"

void EntityManager::createEntity(std::unique_ptr<Entity> entity) {
    entities.push_back(entity);
}

void EntityManager::destroyEntity(std::unique_ptr<Entity> entity) {
    bool entityFound = binary_search(entities.begin(), entities.end(), entity);

    if (entityFound) {
        auto iter = find(entities.begin(), entities.end(), entity);
        entities.erase(iter, entities.end());
    }

    else
        std::cout << "Could not find entity to destroy!" << std::endl;
}

When I try to compile this, it gives me an error in actual c++ files like unique_ptr.h, etc. I can't really post the errors because it's reaaaaally long but what I do know is that the problem is due to me trying to push a unique_ptr into my entities vector. I have also done the same thing with raw pointers to my Entity class (Entity*) and it worked fine, but I don't like dealing with raw pointers because they can get really annoying sometimes (destroying them correctly, etc) and it's just easier to use smart pointers. I hope you guys can help me and thank you for your time  :D

192
General / Re: Does SFML support MySQL?
« on: August 15, 2012, 01:24:10 am »
D: ok

193
General / Does SFML support MySQL?
« on: August 15, 2012, 01:19:06 am »
I need to use a MySQL database to check username and passwords for my game, does sfml 2 support this?

194
Graphics / Are resource managers really necessary?
« on: August 13, 2012, 01:47:48 pm »
I've written a resource manager, and I think honestly it's more pain than just using the plain old methods for the individual objects like textures, soundbuffers, etc. Do you guys think that a resource manager is worth it for a smallish game (under 20000) lines? If so, could you explain why?

195
Graphics / Re: Is this possible?
« on: August 13, 2012, 01:44:12 pm »
Ah yes, of course  ;D hadn't even thought of that, thanks.

Pages: 1 ... 11 12 [13] 14 15
anything