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

Pages: 1 [2] 3 4 ... 25
Graphics / Re: cannon and bullet
« on: May 29, 2015, 03:30:55 pm »
Meanwhile while these guys are arguing about singletons.

Since the cannon fires the bullet it is a "has a" relationship meaning bullet is a field or just simply created by a method in the cannon class.

class Cannon
     Bullet bullet


class Cannon
Bullet fireBullet();

Just some ideas while these guys are arguing. :)

One thing that was funny was I was trying to change out as much of the normal pointers as I could for smart pointers.  As for the discussion, now that I read it, the thing is confusing me too. :(

The idea was main a discussion about tutorials and how some might need fixing and to not just copy the code. :)

PS: The only thing I haven't figured out in that tutorial how to change to smart pointers is the pointer to game. :(  Other than that I basically turned most of it to smart pointers trying to learn them again in C++11. :)

Needless to say I ran into something rather interesting.  It's common knowledge that most tutorials have some bugs in them, especially ones from people that might not know as much as they are letting on but still want to try their best to help.

Most of the time when I'm hunting for tutorials I'm trying to find out something I didn't know but more often than not I also run into my fair share of ones that have bad coding habits and styles in them that might end up teaching some people those vary bad habits.  So I figured why not rip the thing apart and clear out as many bugs, bad habits, and just plain bad code as I could find.

Wasn't sure where to post this either but it sounded like an interesting discussion topic.  Most of the time we get told to shy away from tutorials due to things like bad code practices and other negative things. 

Here's one I did find while hunting for a state machine design to work with: https://www.binpress.com/tutorial/creating-a-city-building-game-with-sfml-part-1-state-manager/123

Now I'll warn you now that some chunks of the code aren't something you want to just C&P.  Make sure when you run into any tutorial to read the code closely and also how the person that made it did things.  This way you can avoid the same bad habits if there are any.  Like others have said in the past don't just straight up C&P the code.  Make sure you understand it well beforehand and try to correct anything that looks like it needs to be in what you run into.  I've found trying to correct other people's errors helps me learn what I want to better and it helps speed things along later as well.

SFML projects / Re: SFGUI (0.2.3 released)
« on: May 27, 2015, 04:32:07 pm »
Just wondering about something.  Are we able to make a bubble circle menu list?  Where each of the buttons and other things in the list is either a floating circle or part of one.  In my case I'm trying to setup a menu for clicking on things that is one center circle with a ring of smaller ones around it.  Just wondering if it could be done. :)

General / Re: Application crashes on another computer
« on: May 26, 2015, 03:21:05 pm »
We have to see this error in order to do anything.  ???

General / Re: Help with changing a sprite direction
« on: May 16, 2015, 04:29:12 am »
Everything i try just doesn't work  :'(

Can anyone help?

I need the ball to rebound off the borders

struct BallData
        sf::Vector2f directionup;
        sf::Vector2f directiondown;
        sf::Vector2f directionleft;
        sf::Vector2f directionright;
        sf::Vector2f startpos;  
        float        speed;    
        bool         active;   
                directiondown = sf::Vector2f(0.0f,1.0f);
                directionup = sf::Vector2f(0.0f,-1.0f);
                directionleft = sf::Vector2f(1.0f,0.0f);
                directionright = sf::Vector2f(-1.0f,0.0f);
                startpos = sf::Vector2f(0.0f,0.0f);
                speed    = 200.0f;
                active   = false;

First off you don't need to store 4 vectors you only need one of them and simply manipulate it to your heart's content.

Like this:

class BallData
        sf::Vector2f direction;
        sf::Vector2f startpos;  
        float        speed;    
        bool         active;   
        BallData(sf::Vector2f directioninput)
                direction = directioninput; // Can be given a random direction in several ways.
                startpos = sf::Vector2f(0.0f,0.0f);
                speed    = 200.0f;
                active   = false;
        void setDirection(sf::Vector2f directioninput){/**/}
        sf::Vector2f getDirection(){/**/}


// Some other file............

Pseudo Code

~Hit lower wall or upper wall
Reflect the Y axis


~Hit Left or Right Paddle
Reflect the X axis



Keep in mind depending on how the playing area is setup this could change a bit.

The general Idea is it is simpler than it looks.  Also learning to use the debugger and the breakpoints of it would also help.  If I remember right most IDEs will let you click in the margin to set breakpoints.

Graphics / Re: Bullet Movement angle issue
« on: March 27, 2015, 12:36:19 am »
The idea is to make sure that the starting firing angle matches that of the starting facing angle of the sprite.  That way the bullets move the way you want them too. :)

Graphics / Re: Create sprites immediately in a certain spot
« on: March 23, 2015, 01:36:15 am »
Thanks for the replies. I'll have to look into it tomorrow. Getting pretty late here. Hopefully I don't have to resort to plan B.
I had to when working with Digipen's Fun Editor.  Was very annoying to say the least since they stored the main copy of an object on the map at (0,0)  ???  ???  ??? That said the only way to bypass the issue of create sprite than set position here would be to either create a subclass of sprite or get someone to make a few more constructors with the position setable from them on the github.

Graphics / Re: Create sprites immediately in a certain spot
« on: March 23, 2015, 12:40:14 am »
hmm I tend to make my own subclass using SFML's sprite class as the base but unless you have to don't bother.  In any event aside from putting in a request on the github for a position parameter to be added the only real way around it is to do this number of creating a subclass.

class MyGameSprite : public sf::Sprite


This is my only excuse for creating a subclass of something in a library like SFML.  If I need to add one or more of the set methods into the constructor as parameters. :)

Also a plan B would be to make the area around (0,0) out to the largest sprite size an area nothing important can happen in like collisions and other things that might happen a bit too fast.

Graphics / Re: Create sprites immediately in a certain spot
« on: March 22, 2015, 11:53:47 pm »
Doesn't the Sprite class have a parameter for Vector where it lets you set the position?  You can use setPosition to put it where you want.  Not sure what the default is though.

Also we can't help much without an example.

SFML projects / Re: Enter the Unknown - Devlog
« on: March 22, 2015, 02:48:44 pm »
Sounds really cool man! How long do you expect this project to take?

When it comes to us programmers it can vary from years to hours.  The word "SOON" comes to mind.

Meanwhile: ghzmdr you might want to post more screenshots of what you are working on so we can see it a bit more. :)  Might help.

SFML projects / Re: RPG card game
« on: March 17, 2015, 02:41:35 pm »
Well in the case of a card store he could setup an in-game currency that can be won win or lose in the duels themselves.  Another way would be too make it so you get random cards at the end of a duel for winning or losing.  The only thing that would change would be how many cards are won.  Now another thing he could do is let players make their own cards within some set limits and trade copies of them.  Say if a new card is detected it is added to the local DB on the player's end who doesn't have it but the number of copies they have of it is set to 0.  This way the card's information is recorded to prevent issues of new cards not working on the other player's end.  The maker of the card has as many as they want while anyone they give it to only gets a number of copies given.

As you can tell there are so many ways to do it, but I'd say starting with all cards available for testing might help since having a limited number in your trunk might cause issues when seeing if it works or not.

Graphics / Re: Flickering issue
« on: March 16, 2015, 02:26:18 pm »
Holy crap... It was due to XFCE's compositing nothing to do with code or SFML... I'm thiking about suing 'em for the night I've spent on this  :o :o :o :o
lol you'd lose.  That aside it is good you found out what was going on. :)

General / Re: Car Control Panel(gauges)
« on: March 14, 2015, 02:21:19 pm »
Like eXpl0it3r said it is basic vector math for this kind of thing.  I think the search is Vector Acceleration Game Math.  Since normal physics equations aren't in game calculation setup by default searching for how to convert them over is easy enough.  You might not run into this issue with a simple movement equation based on player input though so no need to worry about it.  :)

The first 3 or 4 have useful information:

Graphics / Re: sf::Sprite, cannot get to draw.
« on: March 12, 2015, 11:33:11 pm »
For starters move the clear and display methods out into your main game loop where you are drawing your list of sprites.  Can't see anything else that might be causing it though.

Pages: 1 [2] 3 4 ... 25