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 Hatchet

Pages: [1] 2 3 ... 9
1
General / Re: AW: Change a Sprite in a function?
« on: December 08, 2013, 02:27:33 pm »
Well the code is in many ways bad, but if one would ignore that, you might want to pass the sprite by reference instead of by value.

Indeed.  All your code is doing is creating a copy of the sprite in the function, changing the copies scale then deleting the copy as it exits the function leaving the original sprite untouched.

2
Graphics / Re: Sprite::SetScale broken?
« on: November 23, 2013, 08:34:38 pm »
sounds like you're scaling the sprite's X and not the Y.

3
General / Re: sf::String::erase() troubles.
« on: November 20, 2013, 09:03:57 pm »
From what I can tell from your code the you are telling your string to erase only the 2nd to last item in it.  If this isn't your intention maybe you should brush up on how to correctly use the str.erase() method works. String::Erase

4
System / Re: isKeyPressed() function not working
« on: November 15, 2013, 03:33:57 am »
You also have your event handling in your draw method which is all kinds of wrong.

5
Graphics / Re: [C++ and SFML 2.1] Scrolling backgrounds ( y+)
« on: November 09, 2013, 01:46:29 pm »
You aren't setting an initial bg1Sprite.setPosition(x, y) is about the only simple thing standing out

6
General / Re: I'm new and I need help setting up my compiler.
« on: November 07, 2013, 02:55:49 am »
Redo the setup tutorial.  READ EVERYTHING on that page, all the black text, red text, picture text, text text.  READ EVERYTHING!  Your errors are linker errors but all can be resolved if you start fresh and follow all the direction on the C::B setup page. 

I have followed that setup tutorial numerous times across multiple machines and as long as I do it all works fine.

7
General / Re: Collision issue
« on: November 02, 2013, 12:07:52 pm »
should probably be
if(right < gameball.left|| left > gameball.right ||
            top > gameball.bottom || bottom < gameball.top)
 
Assuming all your right, left, top, bottom variables are updating correctly for the player and ball.

and
void Ball::accelerate(Paddle PLAYER)
{
    currentSpeed.y = (ballObject.getGlobalBounds().top
                        + ballObject.getGlobalBounds().height / 2
                            - PLAYER.getRect().top
                                - PLAYER.getRect().height / 2) / 100;
}
seems to take the Y distance between the center of the ball and center of the player and divides it by 100 and sets the balls speed to that.  1)This makes no sense to do whatsoever as the ball would go slower the closer it vertically gets to the player and faster the further away.  2)unless you just randomly created this to make your job harder you probably shouldn't just copy/paste chuncks of code without knowing what they do

8
General / Re: Segfault on destructors of SFML objects
« on: October 31, 2013, 08:51:27 pm »
Well so far from my testing i've found multiple issues. 

1.  When creating the waterlevel if x becomes greater than 1016 it crashes (probably due to the image size of 3200 pixels wide.  the video card may not be able to support this).  I lowered the level size to 256x128 and got further.

2. When creating the sand and going into the Split() function, once the heightmaps size got to 17 the newHeightMap would fail to generate from it. 

This is as far as I've gotten but it seems you're code is riddled with issues.  Maybe you should take a step back and get one aspect of the level generation working at a time.  First make sure all the water gets made and is displayed correclty, then the sand, then the stone, etc.

Also I don't think you are using the vector constructor correctly in your Terrain::split() method.  Correct vector constructors are as follows:
std::vector<int> first;                                // empty vector of ints
  std::vector<int> second (4,100);                       // four ints with value 100
  std::vector<int> third (second.begin(),second.end());  // iterating through second
  std::vector<int> fourth (third);                       // a copy of third

There does not seem to be a std::vector<int> another(int #);  If you want to create an empty vector of a certain size you should create an empty vector then call a resize on it or call vector<int> another(x, 0); where x is how many values you want set to 0

9
General / Re: Trouble setting up SFML with Code::Blocks
« on: October 31, 2013, 03:56:14 am »
http://www.sfml-dev.org/tutorials/2.1/start-cb.php

Read EVERYTHING and by everything I mean EVERYTHING on the page and it should work just fine.  I've setup SFML 2.1 and CB 12.11 just fine multiple times on multiple machines.  as long as you READ AND FOLLOW EVERYTHING AND EVERY STEP on the page you should be fine.

10
General / Re: Help with Collision
« on: October 30, 2013, 09:04:33 pm »
I've always found it's better to check collision first then move if not colliding than to move first, check collision and move back if you are.

Basically create whatever temp variables you need to check the collision, move the temps, check for collision and only allow the REAL object to move if there is no collision.  If a collision is detected for the temp object then you can calculate the difference of the distance between the two objects and move your REAL object that amount, thus having your real object move directly up against the other object.

This approach generally stops the 'My object1 got stuck inside object2 and now can't get out because my checking is always returning true and thus nothing gets moved" scenario

11
General discussions / Re: Moderation reports
« on: October 27, 2013, 12:02:47 pm »
Nope indeed!  There are already another dozen this morning.  Looks like the bots are set to hit any forum with "General" in the title at the least.  Maybe turn on required e-mail/administrator verification before a new user can be made for a while?  Not sure what else this forum software has for a backend against this kind of spam


12
General / Re: Program crashes on exit (but only after moving characters)
« on: October 20, 2013, 07:08:28 pm »
You should post your search function since so far that seems to be where the error is popping up.

13
General / Re: Program crashes on exit (but only after moving characters)
« on: October 20, 2013, 06:23:25 pm »
if your 'search() function makes use of:
vector<int> cibles;
    bool chasing;
    float range;
    int chasing_timer;
 
at all it could be why, since the parent class doesn't have those.  Or since you are passing a pointer to the entity arrays of each maybe some value is getting changed that should be changed.  hard to say without knowing what the function is doing in terms of code.

14
General / Re: Program crashes on exit (but only after moving characters)
« on: October 20, 2013, 05:27:25 pm »
what does the 'search()' function do?  Cuz never in my day have I ever seen a function need to take a dozen arguments.  Like holy cow that function just looks way too busy. 

15
General / Re: Program crashes on exit (but only after moving characters)
« on: October 20, 2013, 04:28:54 pm »
Access Violation means that a chunk of memory for something is trying to be accessed but that object is no longer in memory, or at that location or is currently being accessed by another thread/process.

Since this only happens after you move a sprite around then the error should be somewhere in your move code.  Look at what you are creating or copying around that may lead to problems when the exiting program tries to clean up all its entities. 

Pages: [1] 2 3 ... 9