Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / How can I code a player vs cpu mode

Author
Message
Scope 51791
16
Years of Service
User Offline
Joined: 25th Jul 2008
Location:
Posted: 11th Aug 2008 03:24
Ok, after seeing someone make a pong game. I had to make my own. So I pretty much got a player vs player mode and I am working on the point system*. But when I think about it, I don't know how I could coude a player vs cpu. Plus, I don't want to make the cpu amazingly good. I would want it to lose sometimes. Maybe I could have the CPU's box to follow the ball on the y axis at the same speed. But that would make him never miss. Please, need some help and tips.

*For the point system. I plan on the user inputting how many sets and points per sets he wants for the pong match. So when someone runs out of points, they lose the set.
freight dog
16
Years of Service
User Offline
Joined: 12th Aug 2008
Location: Probably in a airplane
Posted: 13th Aug 2008 05:29 Edited at: 13th Aug 2008 19:33
Well for a simple makeshift method
Make it so each slider can only move at a certan speed.
Get the y axis and write a few if statements

This way the cpu and the player have a fair chance at hitting or missing the ball

Just an idea havent messed with this stuff in a while and just getting back into it my self lemme know how it turns out

Login to post a reply

Server time is: 2024-11-17 21:00:14
Your offset time is: 2024-11-17 21:00:14