FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Any help with C++?





Munin
I'm building a rough version of arkanoid. Is almost all done, but i'm unable to stablish a difference in speed between the ball and the bar.

I'm using "clock_t" to add some delay to the ball, but it applies to the bar too. So, basically, my problem is that the bar is too slow to hit the ball.

I'm using the <conio2.h> library to put some color in the console.

The code is at http://codepad.org/fTP76sPe

Can you tell me what to do? Or any clue to set two different speeds?
IceCreamTruck
Munin wrote:
I'm building a rough version of arkanoid. Is almost all done, but i'm unable to stablish a difference in speed between the ball and the bar.

I'm using "clock_t" to add some delay to the ball, but it applies to the bar too. So, basically, my problem is that the bar is too slow to hit the ball.

I'm using the <conio2.h> library to put some color in the console.

The code is at http://codepad.org/fTP76sPe

Can you tell me what to do? Or any clue to set two different speeds?



I wish I could be more help, but multi-threading (two or more functions running at the same time... pause one and the other keeps going) and separating the timing of the ball and the paddle across these two functions.

I encourage you to spend a moment tweaking this once you have it working, and play your game a lot to get used to the timing and adjust paddle speed as needed. The playability of your game in the end henges on how well the player feels they can control the paddle. The ball will change speeds, the is the challenge of the game, and you have to be able to get the paddle to the ball without much forethought required on where you need to get the paddle ahead of the ball. Allow people to react to where the ball is by keeping the paddle as fast as you can and still making it controllable. Too fast and it will be hard to control. The paddle being too slow IS the problem with most newer versions of this game released.
snowboardalliance
Munin wrote:
I'm building a rough version of arkanoid. Is almost all done, but i'm unable to stablish a difference in speed between the ball and the bar.

I'm using "clock_t" to add some delay to the ball, but it applies to the bar too. So, basically, my problem is that the bar is too slow to hit the ball.


I'm really confused as to what you mean without seeing code. Maybe I'm way off but...

My first impression is you're doing it wrong when you are basing the ball time on "clock_t"

Maybe the entire game should be delayed based on the actual clock, and the game should work as discrete "steps".

Then things like the ball and paddle moving would happen in different amount of "game steps", so they can be different.
IceCreamTruck
snowboardalliance wrote:
Munin wrote:
I'm building a rough version of arkanoid. Is almost all done, but i'm unable to stablish a difference in speed between the ball and the bar.

I'm using "clock_t" to add some delay to the ball, but it applies to the bar too. So, basically, my problem is that the bar is too slow to hit the ball.


I'm really confused as to what you mean without seeing code. Maybe I'm way off but...

My first impression is you're doing it wrong when you are basing the ball time on "clock_t"

Maybe the entire game should be delayed based on the actual clock, and the game should work as discrete "steps".

Then things like the ball and paddle moving would happen in different amount of "game steps", so they can be different.


I think this is correct. You don't want your ball and paddle moving faster on a new computer then they do on an old computer. The ball and paddle should move certain distances over time, not move every chance they get based on the responsiveness/availability of the computer clock. This will help your game play the same on one computer or another.
Related topics
[help]c++ builder
Help: C++ : windows.h
Frihost DC (Distributed Computing) Project
Yabb problem
The Whole "GOD" Thing
HELP ME in C++
Need help in Borland C++ 3.0
C++ assignment help
c++ object design help
Basic C Programming Help?
Help With C++ Searching
Help with C++
[Question] Visual Basic C++, PHP, mySQL language guides...
HELP!!!! My computer keeps rebooting over and over again.
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.