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

Pages: [1]
1
General / Re: Rand() not working?
« on: December 09, 2012, 12:53:36 pm »
Thanks, that fixed it. It was sort of a stupid mistake too, but I went around this several times without being able to fix it.

2
General / Rand() not working?
« on: December 08, 2012, 11:33:34 pm »
Im trying to relocate a sprite using rand(), but it doesn't seem to work

Considering the following excerpt:

std::cout << "Relocating goal..." << std::endl;
                        srand((unsigned)time(NULL));
                        stick_x = (rand() % (640 - 32)) + 1;
                        stick_y = (rand() % (360 - 32)) + 1;
                        std::cout << "Position change..." << std::endl;
                        stick_sprite.setPosition(stick_x, stick_y);

X only increments by a few bits (4 or 5) and Y keeps decrementing (by, like, 30). I have no idea why. Also, this happens upon collision. However, when there is a change in position in only occurs after a second, instead on instantly.

Pages: [1]
anything