|
Help with class |
Money
Member #6,730
December 2005
|
hey, when i draw the first paddle object it shows, but it doens't when i do the second
|
kikabo
Member #3,679
July 2003
|
take this out of you Paddle::getInput class Also, it's strange to have this between draw functions p1->setCoords(30,30); p1->drawPaddle(pBit); p1->getInput(); p2->setCoords(50,50); p2->drawPaddle(pBit); Generally start by grouping all logic functions, then draw, then blit edit: |
Money
Member #6,730
December 2005
|
uhh, i have to have that blit funciton in, other wise it won't show the main game area unless i press enter [edit] |
kikabo
Member #3,679
July 2003
|
Well you already have a blit at the end of your main loop
soon you will need to look at timing so that it will run at the same speed on all computers but first you need to separate logic, then have a search on these forums for timing edit: I'm too slow for this, I've seen your reply now |
Money
Member #6,730
December 2005
|
gah, man something happened, this is my new code, i had to have a while instead of an if statement ingetInput because if there was an if, it would jsut move down on input then return back to position once you let go of key //startClassic.cpp
//paddle.h
i have if(pos_y == 375){drawPaddle(pBit,200);} in paddle.h works, but when i try if(pos_y == 375){drawPaddle(pBit,375);} that doesn't work, i tried setting the boundary for the paddle so if it tried to go past a point it couldn't but anything before like 315 or something like that works oh by the way, i'll put the timer function in main.cpp //main.cpp
but my main problem is that in my startClassic.cpp, it doesn't draw the second paddle at the specified position. please help |
Audric
Member #907
January 2001
|
Quote: i had to have a while instead of an if statement ingetInput because if there was an if, it would jsut move down on input then return back to position once you let go of key
That's the mother of bad reasons... Notice your game now stays stuck in p1.getInput(), until you press ESC: this is a mistake. And because you put drawing code in movePaddle*, which is a mistake as well, you can see and move ONE paddle... |
Thomas Fjellstrom
Member #476
June 2000
|
I have to point out that I spent hours with Money here in the #allegro IRC channel, as did several others on separate occasions, and nothing seems to get through to him, I even gave him a fully working basic prototype that I wanted him to look at, and learn from, and then explain to me how it worked, after that, he got all mad and said "I dont have to waste my time, blah blah blah", and at that point I'd had it, if he couldn't listen, and just got mad at me for trying to help him, I decided that that was the last time I'd ever off him help. All the other #allegro regulars already made that decision days before I did. But hey, if you think you can help him, go for it. Though you're just wasting your time. -- |
|