Hi everyone. I need some help with a simple arcadey game im making.
Its a game with a black background, and an equally black button you need to find and press. Complete with difficulties that change button size, and click counter, so you know how long it took you to find the button. I know how to do most of this, except for the pixel plotting part of it. I got it to work using the Plot command, and using a very small image with types.
(Tried em both to see if the problem im about to tell you would be fixed)
The problem is every time i run it, around the same time too. The plotting works fine, for about 20 plots. After that the game starts lagging, until it just stops responding.
Heres my code if anyone needs any help.
(And it may not look that complete or efficient in some ways, im still working on different aspects but decided to get this working first)
Thanks in advance for the help.
from,
Kevin
Its a game with a black background, and an equally black button you need to find and press. Complete with difficulties that change button size, and click counter, so you know how long it took you to find the button. I know how to do most of this, except for the pixel plotting part of it. I got it to work using the Plot command, and using a very small image with types.
(Tried em both to see if the problem im about to tell you would be fixed)
The problem is every time i run it, around the same time too. The plotting works fine, for about 20 plots. After that the game starts lagging, until it just stops responding.
Heres my code if anyone needs any help.
(And it may not look that complete or efficient in some ways, im still working on different aspects but decided to get this working first)
Graphics 400,400 SetBuffer BackBuffer() SeedRnd MilliSecs() Global start = 0 Global dot = LoadImage("images/dot.png") Global menu = LoadImage("images/menu PNG.png") cursor = LoadImage("images/cursor.png") ;load buttons Global buttonVE = LoadImage("images/button VE.png") Global buttonE = LoadImage("images/button E.png") Global buttonM = LoadImage("images/button M.png") Global buttonH = LoadImage("images/button H.png") Global buttonSH = LoadImage("images/button SH.png") ;Numbered Difficulty Value Global difficulty = 0 Global randval = 1 Global randval2 = 400 Global buttonX = Rand(5,400) Global buttonY = Rand(5,400) Global buttonW = 0 Global seed = 1 Global seed2 = 10 Global clickval = 1 Global backval = 0 ;menu buttons VE = LoadImage("images/VE.png") E = LoadImage("images/E.png") M = LoadImage("images/M.png") H = LoadImage("images/H.png") SH = LoadImage("images/SH.png") While Not KeyHit(1) If KeyHit(59) Then cheat$ = Input("Enter: ") If cheat$ = "find" Then col = 1 Cls ;Rect 0,0,400,400,1 ElseIf cheat$ = "clear" Cls EndIf EndIf If start = 0 Then ;if very easy is pressed If ImagesOverlap(cursor,MouseX(),MouseY(),VE,27,105) And MouseHit(1) Then difficulty = 1 start = 1 Cls EndIf EndIf If start = 1 Then If difficulty = 1 Then DrawImage buttonVE, 0,0 EndIf Color 255,255,255 ;Rect randval, randval2,50,50,1 ShowPointer() If MouseHit(1) Then Plot MouseX(),MouseY() clickval = clickval + 1 ;ElseIf MouseHit(1) And MouseX() > buttonX And MouseX <buttonX + buttonW And MouseY()>buttonY And MouseY()<buttonY + buttonyH Then ;ClsColor 255,255,255 ;Cls EndIf EndIf If start = 0 Then Cls DrawImage menu,0,0 DrawImage VE,27,105 DrawImage E,230,105 DrawImage M,27,152 DrawImage H,230,152 DrawImage SH,123,225 EndIf If start = 0 Then HidePointer() DrawImage cursor,MouseX(),MouseY() EndIf Flip Wend End
Thanks in advance for the help.
from,
Kevin