stuck on game
Author |
Message |
tidusraven
|
Posted: Fri Jan 15, 2010 10:08 am Post subject: stuck on game |
|
|
im stuck on trying to make the ball on top move, and im having some trouble finishing off my code because im not sure exactly how to make it
Turing: |
< %Dennis
%Game
var chars : array char of boolean
var y, yy, xcounter, x, xx, balls : int
var choice : string
var turn : int := 1
y := maxy div 2 - 140
yy := maxy div 2 - 190
var x2 := 50
var y2 := maxy
var ball : int := 0
View.Set ("graphics")
drawfillbox (0, 0, 900, 605, black)
colorback (black)
color (14)
Mouse.ButtonChoose ("multibutton")
setscreen ("nocursor")
put "Type in the difficulty (easy,medium,hard) or type in anything else to view the info."
get choice
xcounter := maxx div 2 - 25
if choice = "easy" then
xx := 70
y := 30
yy := 0
elsif choice = "medium" then
xx := 50
y := 20
yy := 0
elsif choice = "hard" then
xx := 25
y := 15
yy := 0
else
put "To move side to use, use arrow keys ( <- -> ), to gain points collect the balls" ..
get choice
end if
View.Set ("graphics")
Draw.FillBox (xcounter, y, xcounter + xx, yy, yellow)
View.Set ("offscreenonly")
loop
y2 := y2 - 1
drawfillbox (0, 0, 900, 605, black)
Input.KeyDown (chars )
if chars (KEY_RIGHT_ARROW) then
xcounter := xcounter + 1
cls
Draw.FillBox (xcounter, y, xcounter + xx, yy, yellow)
elsif chars (KEY_LEFT_ARROW) then
xcounter := xcounter - 1
cls
Draw.FillBox (xcounter, y, xcounter + xx, yy, yellow)
end if
drawfilloval (x2,y2, 10, 10, black)
delay (10)
drawfilloval (x2, y2, 10, 10, yellow)
if x2 > x and x2 < xx and y2 = y then
View.Update
end if
end loop
>
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Turing_Gamer
|
Posted: Fri Jan 15, 2010 10:13 am Post subject: Re: stuck on game |
|
|
First have your cls at the begining of your main code and your View.Update out of the if loop and at the bottom.
Then have your Draw.Pic's right after the cls.
And in your keying spots have them changing the varaible only, remove the cls in them |
|
|
|
|
|
tidusraven
|
Posted: Fri Jan 15, 2010 10:22 am Post subject: Re: stuck on game |
|
|
Turing_Gamer @ Sat Jan 16, 2010 2:13 am wrote: First have your cls at the begining of your main code and your View.Update out of the if loop and at the bottom.
Then have your Draw.Pic's right after the cls.
And in your keying spots have them changing the varaible only, remove the cls in them
alright well what you said and im still having an issue
i did this like you said
loop
cls
y2 := y2 - 1
drawfillbox (0, 0, 900, 605, black)
Input.KeyDown (chars)
if chars (KEY_RIGHT_ARROW) then
xcounter := xcounter + 1
Draw.FillBox (xcounter, y, xcounter + xx, yy, yellow)
elsif chars (KEY_LEFT_ARROW) then
xcounter := xcounter - 1
Draw.FillBox (xcounter, y, xcounter + xx, yy, yellow)
end if
drawfilloval (x2,y2,10,10,black)
delay (10)
drawfilloval (x2, y2, 10, 10, yellow)
if x2 > x and x2 < xx and y2 = y then
end if
end loop
View.Update |
|
|
|
|
|
TheGuardian001
|
Posted: Fri Jan 15, 2010 10:38 am Post subject: Re: stuck on game |
|
|
Will your program ever reach the View.Update line, which you put outside of the loop? |
|
|
|
|
|
ProgrammingFun
|
Posted: Sat Jan 16, 2010 9:32 am Post subject: RE:stuck on game |
|
|
You either need to put View.Update inside the loop or exit the loop with something like:
exit when variable = 10
so that your program can get to the View.Update screen.
If however, you cannot exit your loop, you can put this loop and the View.Update in another loop so that when you exit, it will automatically startup again but it will have done View.Update. |
|
|
|
|
|
Turing_Gamer
|
Posted: Sun Jan 17, 2010 3:55 pm Post subject: Re: stuck on game |
|
|
lol i meant this
Turing: | loop
cls % RIGHT HERE
y2 := y2 - 1
drawfillbox (0, 0, 900, 605, black)
Input.KeyDown (chars )
if chars (KEY_RIGHT_ARROW) then
xcounter := xcounter + 1
Draw.FillBox (xcounter, y, xcounter + xx, yy, yellow)
elsif chars (KEY_LEFT_ARROW) then
xcounter := xcounter - 1
Draw.FillBox (xcounter, y, xcounter + xx, yy, yellow)
end if
drawfilloval (x2,y2, 10, 10, black)
delay (10)
drawfilloval (x2, y2, 10, 10, yellow)
View.Update % AND RIGHT HERE
end loop |
|
|
|
|
|
|
tidusraven
|
Posted: Mon Jan 18, 2010 9:53 am Post subject: Re: stuck on game |
|
|
alright thanks , also i was wondering how to make the ball disapear when it hits the a certain Y , i understand that every difficulty has a value for y, but how would i make it disapear for lets say easy
y := maxy div 2 - 140
yy := maxy div 2 - 190
var xx:int
xcounter := maxx div 2 - 25
if choice = "easy" then
xx := 70
y := 30
yy := 0 |
|
|
|
|
|
Turing_Gamer
|
Posted: Mon Jan 18, 2010 12:01 pm Post subject: Re: stuck on game |
|
|
I would have if you hit a target with a certain bullet then move specific bullet offscreen, reset target, score incriment, etc. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
tidusraven
|
Posted: Mon Jan 18, 2010 7:39 pm Post subject: RE:stuck on game |
|
|
yea someone also suggested the thing, but any clue on how i could do it? if you don't want to give me the script, any chance you can link me to a tut and then i can try to figure it out myself. |
|
|
|
|
|
Turing_Gamer
|
Posted: Mon Jan 18, 2010 9:35 pm Post subject: Re: stuck on game |
|
|
I believe you can figure this one on your own.
- Moving bullet offscreen is easy, just set the xbullet value to a negative number. Call it back when you fire
- Reseting target is also not a problem. I suggest a random x position and an offscreen y position
- Score incriment is very simple (score := score + 1)
I'm not being rude, I'm just giving you a general direction. And isn't discovery better when you do it yourself???
Good Luck... |
|
|
|
|
|
|
|