Breakout game (need help with some colour related functions)
Author |
Message |
shlitiouse
|
Posted: Tue May 17, 2005 8:44 pm Post subject: Breakout game (need help with some colour related functions) |
|
|
Alright, my dad is a HUGE fan of the old school breakout games, but can't find one that he likes, so I've decided to get to work on making one for him. there's just one small problem. My teacher told me that turing had a function that could read the colour of a pixel, and I'd be able to tell the computer something like, if there's a pixel touching the ball that's, let's say, red. drawfill a box of the background colour over where that box had been before. So basicaly what I'd like to know is, is there a function that can read the colour? (I've looked into the whatdotcolor function, but I'm not sure if this will work) Could someone just write up an example of what the coding would look like for detecting when say, a yellow ball touches a red block?[/code] |
|
|
|
|
|
Sponsor Sponsor
|
|
|
ssr
|
Posted: Tue May 17, 2005 9:42 pm Post subject: (No subject) |
|
|
code: | View.Set("offscreenonly")
var key: array char of boolean
var x,y:= 100
loop
delay (10)
Input.KeyDown (key)
if key (KEY_UP_ARROW)
then y+= 5
end if
if key (KEY_DOWN_ARROW)
then y-= 5
end if
if key (KEY_LEFT_ARROW)
then x-= 5
end if
if key (KEY_RIGHT_ARROW)
then x+= 5
end if
View.Update
cls
drawfilloval (x,y, 2,2, 5)
%%%%%%%%%%%%%%%whatdotcolor
drawfilloval (300,200,10,10,8)
if whatdotcolour (x+ 3, y) not= 0 then
put "BALLS MEET"
end if
end loop |
there are better ways of using them but this is ok 8) |
|
|
|
|
|
|
|