Page 2 of 4

Posted: Wed Jan 11, 2006 8:01 pm
by Fred
you have to pass WindowID(0) as first parameter of OpenWindowScreen() else it won't work. You can also use the search function of this forum to see how use OpenWindowedScreen(). For example this one show it:

viewtopic.php?t=18473&highlight=openwindowedscreen

Posted: Wed Jan 11, 2006 9:21 pm
by Dark Mars Software
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:

Code: Select all

solved
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.

Posted: Wed Jan 11, 2006 10:07 pm
by Fred
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 = 0

Posted: Wed Jan 11, 2006 10:17 pm
by blueznl

Posted: Thu Jan 12, 2006 12:25 am
by Dark Mars Software
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:

Code: Select all

fixing
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?

Posted: Thu Jan 12, 2006 2:04 am
by Straker
@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.

Posted: Thu Jan 12, 2006 3:29 am
by Dark Mars Software
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?

Posted: Thu Jan 12, 2006 7:09 am
by blueznl
no :-)

Posted: Thu Jan 12, 2006 7:00 pm
by Dark Mars Software
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.

Posted: Sat Jan 14, 2006 3:57 am
by Dark Mars Software
Listen i said i was sorry and explained myself. As i said it was for copy protection reasons. Can someone please help me out?

Posted: Mon Jan 30, 2006 8:33 pm
by Dark Mars Software
Why is no one responding? Does everyone in this community hate me for doing this?

Posted: Mon Jan 30, 2006 8:47 pm
by netmaestro
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".

Posted: Mon Jan 30, 2006 8:50 pm
by wcardoso
Dark, the best you can do is what your avatar is doing... :evil:

Posted: Mon Jan 30, 2006 8:53 pm
by Pupil
Dark Mars Software wrote:Why is no one responding? Does everyone in this community hate me for doing this?
Yes that is correct ;)
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

Posted: Tue Jan 31, 2006 12:49 am
by Dark Mars Software
Pupil wrote:
Dark Mars Software wrote:Why is no one responding? Does everyone in this community hate me for doing this?
Yes that is correct ;)
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
Thats did the trick. Thanks