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

Pages: [1] 2
1
Graphics / Interesting question about the viewport
« on: January 18, 2012, 06:41:12 pm »
I second that one big image and use SetSubRect to get the tiles.
About the scrolling out of the viewport.  I am curious to see
what answers come up because I am using one in my next project

2
Graphics / Loop problems with animation (AniSprite)
« on: January 17, 2012, 05:40:13 pm »
Nexus is right.  I probably shouldn't post technical answers from my i-Phone while watching Star Trek Re-runs.  

Did you get it to work?

3
Graphics / Loop problems with animation (AniSprite)
« on: January 15, 2012, 05:28:10 pm »
IntRect is from the sprite class.  You can fix it with sf::IntRect or simply by using namespace SFML; in your header

4
Graphics / Redrawing Sprites in a Multi - Threaded Program
« on: January 15, 2012, 01:02:41 am »
Quote from: "Groogy"
Your way off if that's what you want to do. This can be done and should be done single-threaded. You don't have to play the entire animation directly in a sequence. You just have to advance the animation frame when enough time have passed. Check out the animation classes in the SFML Wiki.

You are doing a common rookie mistake here when it comes to threads. And I better stop talking here or I can give hour long lectures on how to properly use threads to achieve optimal parallelism (which is their intended usage). And why not to use threads to complete a single task in parallel like you are doing.


Thanks.  I will just keep it all in one thread. That should be easy enough to do.  What about playing a separate sound above the background music.  Should this also stay in the main thread?

5
Graphics / Loop problems with animation (AniSprite)
« on: January 15, 2012, 12:46:47 am »
I use SFML 1.6.  And the same applies.  According to everything I have read, sheets are the way to go.  Images are heavy clunky objects.  Sprites are just tiny little data structures.  That don't contain the image at all.  They just have a reference of where to get it from.  For this reason you want more sprites and less image files.

Even if you only have a 2 or 3 frame animation.  Multiple sprites for animation is discouraged everywhere I look.  You can look around further and I think you will find the same.  I don't think it is a good practice to use.

Using a spritesheet is pretty easy with SFML.  All you need to do is load up your sheet for the sprite and you can move from frame to frame with setsubrect like this:

Code: [Select]


// Frame 1
mySprite.SetSubRect(IntRect(0,0,32,32));
// Frame 2
mySprite.SetSubRect(IntRect(32,0,64,32));






.

6
Graphics / Redrawing Sprites in a Multi - Threaded Program
« on: January 14, 2012, 11:34:16 pm »
Thanks for your replies.  Now I am not sure how to achieve what I want. When I broke it into two separate threads, the animation sequence I wanted was jerky and would skip frames, because the only thing redrawing the screen was in Main.  

The reason for me wanting to start another thread was:

I want to have my character freeze and do an animation of about 1 second on certain collisions, but I do not want this to stop the enemy from advancing.


So what is the best approach to achieve this?

7
Graphics / There is a better way
« on: January 14, 2012, 04:11:50 am »
Looks like a cool program you are writing  8)

I thought about doing animation with multiple sprites but everywhere I read advised strongly against it.  It seems the most efficient way to do it is with a sheet of sprites.  Check out this thread http://www.sfml-dev.org/forum/viewtopic.php?p=27588&sid=dbf53e03d0bada800e5d622830c6d2b2 for more details.

I have been using sheets and they work really nice.

8
Graphics / Redrawing Sprites in a Multi - Threaded Program
« on: January 14, 2012, 03:11:21 am »
I am working on my first game.  I have been stuck for the last few hours and I just cannot figure out how to redraw my sprite in a separate thread.   First I created a struct with a bunch of pointers.  Then I set up a new thread and passed the struct in.  Everything worked great until I tried to redraw the sprite.

Whenever I try to access the sf::RenderWindow.Draw Function, I don't have the right Object type to pass in.  It needs a reference to a Sprite Object, and I only have a pointer.
I tried converting it with a line like the one below but the compiler rejected it with this message: error C2440: 'initializing' : cannot convert from 'sf::Sprite *' to 'sf::Sprite &'
Code: [Select]
Sprite& rPlayer (pSprite);

I tried not using a pointer and just including a Sprite Object in the Struct.  It compiled but when the thread launched, the program froze up for a few seconds, and gave me a bunch of OpenGL error messages in the console window.  I can't figure out what to do with my Pointer so I can pass my sprite in to the sf::RenderWindow.Draw function a separate thread.

Any Help would be greatly appreciated!

My Code looks something like this.

Code: [Select]

struct UserData{
int* pMap;
RenderWindow* pApp;
Sprite* pSprite;
AnimationClass* pAnimator;
};

void ThreadFunction(void* UserData)
{

    for (int i = 0; i < 10; ++i)
{
Data->pAnimator->myAnimation(pSprite);
Data->pApp->Draw(???????What can I pass in here???????);
}
}


int main()
{

    UserData Data = { pMap, pApp, pSprite, pAnimator };
    sf::Thread myThread(&ThreadFunction, &Data);
    myThread.Launch();

    return EXIT_SUCCESS;

}

9
General / Re: PacMan Movement Not Working Properly
« on: January 02, 2012, 08:04:49 pm »
Quote from: "Ballistic"


It's basically a PacMan clone. In the end product I hope to have 4 ghosts methodically running around a maze. But right now, I'm having a little trouble getting the player to move. My code will render the player at the bottom of the screen, but he just sort of jitters in place a bit when I try to move him.
 :D


"4 ghosts methodically running around a maze"

I am working on a pac-man derived game myself.  While there is nothing wrong with having the ghosts methodically running around the maze.  One of the best features of the original Pac-Man was the AI of the 4 ghosts.  And it is not that difficult to replicate.  The article below explains the how the ghosts AI worked in full detail.

Here is the link:

http://home.comcast.net/~jpittman2/pacman/pacmandossier.html

10
General / Packaging my open source game with SFML questions
« on: January 02, 2012, 07:52:26 pm »
Hello,

    I have an almost finished game that I plan to publish shortly as open source.   It is my first game.   The project has been a lot of fun and I have really enjoyed working with the SFML library.  It is a great way to learn C++.  

    I am not looking for anyone to help me complete the game.  My reason for going open is that I want it to be available so that other programmers working on their first game can see how I did mine.  And it would be great to show it to some experienced programmers that can look at what I did and possibly help me improve my programming.

    My question is about including the SFML library in the source.  I would love it if anyone could download the source and as long as they are running visual studio it would just compile and run automatically.  But of course they wouldn't be able to unless they had SFML installed, and their linker set up the right way.  (SFML is the only library I have used for this game).  

     It took me two days and a few forum posts to figure out just how to set up my linker the right way, and to get all of the files in the right place.  Maybe I am just slow, but I imagine other beginners who downloaded my source would come across similar problems.

So my questions are:

Is it possible / and permissible to include the entire SFML library in the source along with my program in order to make it easier for me to share my program with others?  

If so, can someone give me a zipped folder of a Visual Studio project/solution that includes all of the SFML library, and all of the files automatically configured in the linker, and all of the .dll files placed in the runtime folder?

Thanks! 8)

11
SFML projects / Nice Video
« on: December 21, 2011, 02:33:41 am »
Really liked your AI video!

12
Graphics / Some Images
« on: December 08, 2011, 02:24:06 am »
If this helps any, here is the tileSheet I am using, and the maze I want to build with it:

(The plant/grass tile has been updated since I made my last mockup of the map)

Tile Set:




Maze:


13
Graphics / Questions on My First Tile Map
« on: December 08, 2011, 02:05:33 am »
I am having fun plugging away at my first game using SFML, when I get it a little further along, I will post it up here, and on sourceforge.   I am working on the tile map now.  

I have 2 questions, I will probably have more later, but these  should get me through the map.


1. Is using a normal Multi-Dimensional array of sprites OK?
    Something like this

Code: [Select]

sf::Sprite tileArray [11] [9];


    In the examples I saw here everybody was using Vectors
    am I better off using a Vector, if so why?


2. I am using 96 x 96 tiles some go the full 96 pixels
    but many of them have smaller images inside and some
    empty background space.  I haven't started on my collision
    detection yet, but I am a little worried this can cause a problem
    down the road. Specifically:
    Is there any thing other than specifying the exact boundaries
    of each image inside the 96x96 tile that I could use to tell if there
    is an actual collision with the pixels of the image, and not just a    
    collision of empty background space?

Thanks,

14
SFML projects / Great game
« on: November 26, 2011, 01:18:40 am »
And great concept.  Played it 20x already

15
Window / Thank you
« on: October 11, 2011, 11:49:10 am »
Yes that did the trick.  Thank you.  

Really enjoying working with SFML !

 :)  :)

Pages: [1] 2