Pong Master - WIP Error Help?
-
Dark Mars Software
- User

- Posts: 68
- Joined: Sat Jun 19, 2004 3:34 am
- Location: USA
- Contact:
K i fixed up the code abit. However i now notice that my game runs awfully slow. When the game loads i get a hourglass the whole time the game runs. When i click the window the game freezes up and i have to click end program to kill it. Also the sprites not being positioned correctly bug still excists. Heres the modified code:
I looked in my task manager and my game consumes 39% of my cpu resources! Yikes. No, i don't have the debugger enabled.
EDIT:Adding SetFrameRate(30) before the start of the loop only increased the cpu usage to 80% as opposed to decreasing it like it should.
Code: Select all
solved
EDIT:Adding SetFrameRate(30) before the start of the loop only increased the cpu usage to 80% as opposed to decreasing it like it should.
Last edited by Dark Mars Software on Thu Jan 12, 2006 12:38 am, edited 1 time in total.
Pong Master:Open Source Pong - 40% Complete
you have to manage the event loop. Remove the delay(1) and put this instead:
Code: Select all
Repeat
event = windowEvent()
If Event = 0
Delay(10)
EndIf
Until Event = 0eventloop here...
http://www.xs4all.nl/~bluez/datatalk/pure4.htm#4_events
openwindow here...
http://www.xs4all.nl/~bluez/datatalk/pu ... openwindow
http://www.xs4all.nl/~bluez/datatalk/pure4.htm#4_events
openwindow here...
http://www.xs4all.nl/~bluez/datatalk/pu ... openwindow
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
-
Dark Mars Software
- User

- Posts: 68
- Joined: Sat Jun 19, 2004 3:34 am
- Location: USA
- Contact:
Fred, i added you code and it worked. I hade to keep the Delay(1) command or else the cpu usage wouldn't drop below 40%. I managed to get it to 25-30% which is normal i guess.
Tell me if this is correct:
Also the objects aren't being positioned correctly. The ball should be positioned at 240,320 but, appears at 0,0 instead. The bats x position should be 300 but, appears at 0 instead. Any ideas?
Tell me if this is correct:
Code: Select all
fixing
Last edited by Dark Mars Software on Tue Jan 31, 2006 12:48 am, edited 1 time in total.
Pong Master:Open Source Pong - 40% Complete
@Dark Mars Software
Please stop removing your previous postings just because something is solved. Please post a new reply explaining the solutions. This is to help people in the future who might be searching these forums for the same or similiar problem.
Besides, it makes my replies look stupid when you change the question. I am fully adept at making myself look foolish without help. Thank you.
Please stop removing your previous postings just because something is solved. Please post a new reply explaining the solutions. This is to help people in the future who might be searching these forums for the same or similiar problem.
Besides, it makes my replies look stupid when you change the question. I am fully adept at making myself look foolish without help. Thank you.
-
Dark Mars Software
- User

- Posts: 68
- Joined: Sat Jun 19, 2004 3:34 am
- Location: USA
- Contact:
Sorry, also i don't like posting my full source code as anyone can copy it and sue me claiming i stole it from them and/or modify it some and sell it without actually doing any of the "manual labor". Do you understand now?
Pong Master:Open Source Pong - 40% Complete
no 
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
-
Dark Mars Software
- User

- Posts: 68
- Joined: Sat Jun 19, 2004 3:34 am
- Location: USA
- Contact:
k, if i post the full source, someone can chane the graphics, sounds and some gameplay, compile it and sell it for 5 bucks a piece without ever having to write any code what so ever. Since most of the code for a person needs for a pong clone is being posted, all the user has to do it finish it, change the graphics and sounds, compile it and sell it. Its nothing against the community.
Pong Master:Open Source Pong - 40% Complete
-
Dark Mars Software
- User

- Posts: 68
- Joined: Sat Jun 19, 2004 3:34 am
- Location: USA
- Contact:
Listen i said i was sorry and explained myself. As i said it was for copy protection reasons. Can someone please help me out?
Pong Master:Open Source Pong - 40% Complete
-
Dark Mars Software
- User

- Posts: 68
- Joined: Sat Jun 19, 2004 3:34 am
- Location: USA
- Contact:
Why is no one responding? Does everyone in this community hate me for doing this?
Pong Master:Open Source Pong - 40% Complete
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Of course not. It's just that a lot of the problems you're experiencing can be solved with a bit of research. There is lots of material on the forums and at Purearea.net for you to learn basic concepts on. Look for "Code Archive".
Last edited by netmaestro on Tue Feb 21, 2006 6:39 pm, edited 2 times in total.
BERESHEIT
Yes that is correctDark Mars Software wrote:Why is no one responding? Does everyone in this community hate me for doing this?
however putting that aside, you absolutely NEED to put the Initialization of the globals at the top of your source, and by that i don't mean calling a procedure that has a lot of Global statements inside. This is how i prefer to layout my source code:
Code: Select all
; First - declare constants that need defining
#My_own_constants = 1
; Second - declare structures if any is needed
Structure MyMegaStructure
a.b
EndStructure
; Third - declare globals, arrays, linked lists
Global myGlobal.l, anotherGlobal.w
Dim AnArray.l(10, 10)
NewList My_LL.l()
; Next - declare procedures etc
-
Dark Mars Software
- User

- Posts: 68
- Joined: Sat Jun 19, 2004 3:34 am
- Location: USA
- Contact:
Thats did the trick. ThanksPupil wrote:Yes that is correctDark Mars Software wrote:Why is no one responding? Does everyone in this community hate me for doing this?![]()
however putting that aside, you absolutely NEED to put the Initialization of the globals at the top of your source, and by that i don't mean calling a procedure that has a lot of Global statements inside. This is how i prefer to layout my source code:Code: Select all
; First - declare constants that need defining #My_own_constants = 1 ; Second - declare structures if any is needed Structure MyMegaStructure a.b EndStructure ; Third - declare globals, arrays, linked lists Global myGlobal.l, anotherGlobal.w Dim AnArray.l(10, 10) NewList My_LL.l() ; Next - declare procedures etc
Pong Master:Open Source Pong - 40% Complete

