Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a simp
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2, 3, 4, 5  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chandrapanta




PostPosted: Wed Dec 30, 2015 4:11 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

ping pong already has multiplayer so why would i add it again? Wow thanks for crushing my hopes of making snakes or tetris or anything for that matter. Do you mean single player? If i add single player then i need to have blocks for it to hit. Or is that breakout? Whatever in single player should i should keep everything the same but remove the second player?
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Wed Dec 30, 2015 4:44 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

You could. Or you could write an AI to control the opposite paddle, which would be more interesting.

I don't mean to crush your dreams. I mean that you should finish up your current project before moving on to something bigger. We gave you a link to a tutorial to fix the flickering in your game, and you told us it was too hard for you (it's not). Do you think there won't be flickering in Snake or Tetris? It will be worse, unless you learn how to solve it.

Do you think calculating collisions between complicated shapes like in Tetris is any easier than between a paddle and a ball? The code for those collisions alone would be longer than the entire code you wrote for Pong.

You gave up on Pong, but you want to move on to a bigger, more difficult project? Don't limit yourself, but don't set unrealistic goals either. Take things in steps. You will be able to make Snake or Tetris very soon, but you need to learn the basics. Otherwise, you'll be wasting both your time and ours asking huge, broad questions like 'how do I make tetris shapes not fall through each other' when you haven't even discovered how to detect a collision between simple rectangles.
chandrapanta




PostPosted: Thu Dec 31, 2015 8:51 am   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

What do u mean write an AI and control the opposite paddle? What is an AI and explain what is supposed to be meant from controlling the opposite paddle???
Nathan4102




PostPosted: Thu Dec 31, 2015 9:39 am   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

After you hit it from one side, make the program try to hit it back to you.
chandrapanta




PostPosted: Thu Dec 31, 2015 5:18 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

So basically one player? Or the computer is controlling a paddle of its one? If I have one player then the person has to hit the other side and when it bounces off the wall and goes behind the paddle then they lose? Is that what u mean? Can u eleobrate more?
Nathan4102




PostPosted: Thu Dec 31, 2015 9:53 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

Your player controls one paddle, the program controls the second paddle. Based on what side misses the ball, give a point to the appropriate side.
chandrapanta




PostPosted: Fri Jan 01, 2016 9:56 am   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

How do i make the computer control one of them? like what do i use, i dont think i have learned how to make the computer control itself. And do i just copy my multiplayer codes but delete the part about the other player? Please explain!
Insectoid




PostPosted: Fri Jan 01, 2016 4:39 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

Quote:
i dont think i have learned how to make the computer control itself.


You made the computer control the ball, didn't you? This is no different.

The paddle only does two things, move up and move down. Look at the code for the player controlled paddles:

code:
if up arrow is pressed then
    move paddle up
if down arrow is pressed then
    move paddle down
end if


The code for the AI (artificial intelligence, ie computer player) paddle will be almost the same. Obviously you can't use the keyboard to decide what the paddles will do, so you need to find some other way to decide. Think about it, when would you want the paddle to move up? When do you want it to move down?
Sponsor
Sponsor
Sponsor
sponsor
chandrapanta




PostPosted: Fri Jan 01, 2016 4:54 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

when the ball comes near it?
Insectoid




PostPosted: Fri Jan 01, 2016 5:51 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

When YOU play the game, when do you push the up key? When do you push the down key?
chandrapanta




PostPosted: Sat Jan 02, 2016 6:10 am   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

I push the key randomly. Or if the ball is heading up then I push key up and if it's heading down I push down arrow.
Insectoid




PostPosted: Sat Jan 02, 2016 2:38 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

Quote:
if the ball is heading up then I push key up and if it's heading down I push down arrow.


So make the computer do this. If the ball is going up, move the paddle up. If the ball is going down, move the paddle down.
chandrapanta




PostPosted: Sat Jan 02, 2016 2:56 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

But then how can the other player score a point? If the paddle follows exactly the ball how is the ball gonna go behind?Or is that the point?
Nathan4102




PostPosted: Sat Jan 02, 2016 5:48 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

You could make the paddle move at a certain vertical speed, a speed less than the max vertical speed of the ball. That way you'll be able to score ocasional points against the cpu
chandrapanta




PostPosted: Sat Jan 02, 2016 8:07 pm   Post subject: RE:How to make the ball bounce, without using anything too complicated (no whatdotcolor or maxy,maxx) I want to find a s

Yo mean make the delay for the paddle that the computer is control longer than the ball and my paddle?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 4 of 5  [ 67 Posts ]
Goto page Previous  1, 2, 3, 4, 5  Next
Jump to:   


Style:  
Search: