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 ... 13 14 [15]
211
Graphics / Re: Best way to create tilemaps?
« on: July 23, 2012, 03:46:13 am »
Trust me, I've googled it A LOT, but I wanted to know C++/SFML specific ways to make it easier, because a lot of tutorials were with like cocos2d with Objective-C, or Java. And I'll read up on VertexArrays, and it would really be nice if somebody explained the concept just a bit  ;D

212
Graphics / Best way to create tilemaps?
« on: July 23, 2012, 03:29:14 am »
For my engine that I'm creating, I want to include tilemap support. The problem is, I want several different things and I don't really know how to do it in a clean, simple way. A way that I know I could do it is with multidimensional arrays and manually assigning them in code, but I'm not so sure that's the easiest way. Is there a way to read the values from a txt file or XML file? I also want to make it to where some tiles have collision against them. Like for example, if you attempt to run onto a rock tile, you would collide against it and stop. Same with water, etc. Help is greatly appreciated, thank you for your time.

213
Thank you so much for your help! You're right I need to get better with pointers  :P.

214
Your code works... somewhat.. Only about a quarter of the button sprite I'm loading actually responds. Heres my modified code:

bool Button::isSpriteClicked(Sprite& sprite, RenderWindow* window) {
    sf::IntRect rect(sprite.getPosition().x, sprite.getPosition().y, sprite.getGlobalBounds().width, sprite.getGlobalBounds().height);

    if (rect.contains(Mouse::getPosition()) && (Mouse::isButtonPressed(Mouse::Left))) {
        TextureManager tm;
        Sprite sprite1;
       
        sprite1.setTexture(tm.getTexture("cute_image.jpg"));
        tm.drawSprite(sprite1, *window);
       
        return true;
    }
   
    return false;
}

Pretty much, what I want is if the mouse is in the area AND clicking then using my texture manager I coded draw another image as long as the user is holding down the left mouse button. Like I said before, only about half of it works because when I click in the left quarter of the button sprite, it will respond perfectly. But anywhere else on the sprite? It won't do a thing. I don't know why it's doing this....

215
Well I wrote the methods, but I'm kind of confused on how to put the rect around the sprite. I read the documentation on rect, but I'm still kind of confused.

216
bool Button::isSpriteClicked(Sprite *spr, IntRect *rect, Vector2i *rectPosition, RenderWindow *rw) {
    Mouse mouse;
    Vector2i mousePosition = mouse.getPosition();
   
    //If mouse position is in the rectangle do whatever
    if (rect->contains(mousePosition)) {
       
        return true;
    }
   
    //Otherwise, don't do anything
    else {
       
        return false;
    }
}

Does this look correct to you guys?

217
Oh no, I wasn't asking for anybody to write code for me. I just needed help visualizing how it would work. What you have told me is sufficient, thank you.

218
I was having some trouble writing a isSpriteClicked class, and I need some help. Here is what I have so far.

bool Button::isSpriteClicked(Sprite* spr, RenderWindow* rw) {
   
}

Could anybody help me write something that would check if the mouse was in the area, or clicking on a sprite? Thanks.

219
SFML projects / Re: SFGUI
« on: July 22, 2012, 01:08:15 am »
Thanks for the help, but I've officially given up on SFGUI. I cannot figure out how to include it into my original Xcode project or anything like that. I've tried all day, but I guess I'm stuck with plain old SFML....

220
SFML projects / Re: SFGUI
« on: July 21, 2012, 10:20:49 pm »
I'm sorry I'm being vague, I'm very new to Cmake and I'm not very familiar with it. What I am talking about, is when I try to build SFGUI on my Mac, I point the source to the main directory of SFGUI, and I point where to build the binaries is a folder that I created inside of it called "build". But, when I try to generate it using Xcode, it gives me an error that says CMake Error: The source directory does not appear to contain CMakeLists.txt. I am very frustrated and I really want to use SFGUI in my adventure game. Any help with this would be IMMENSELY appreciated.

221
SFML projects / Re: SFGUI
« on: July 21, 2012, 05:22:10 pm »
I have been trying to use Cmake to compile it with Xcode, but I keep getting these weird errors like "does not appear to have cmakelists". I'm also very confused on where to point the source code part of it to. Help anyone?

222
SFML projects / Re: SFGUI
« on: July 21, 2012, 03:47:54 pm »
Is SFGUI available on Mac? (Xcode)

223
Thanks for such great replies guys! I develop on my Mac, and I'm looking into using SFGUI because it looks the most promising. Do you guys know if it is available on Mac?

224
Hi there, I'm relatively new to SFML and I have successfully made a pong clone, and I'm working on my own 2d game engine. So far, I have implemented a texture manager, a state machine for the actual engine, and a bounding box collision system. Everything works, I have tested it all already. The one thing I'm having trouble with though, is how the main menu buttons are going to work. I need some help figuring out a class for the main menu, and it's methods that will check if the mouse is clicking or hovering over some text. For example, I want 2 buttons, which are play and exit, that when you hover over the text, it will change colors and when you click it, it will either start the actual game, or exit the program.

Any help is hugely appreciated, and thank you for your time.

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