
-----------------------------------
jonos
Sun Feb 01, 2004 4:47 pm

collision detection
-----------------------------------
im trying to make a game, but i didn't understand the collision detection tony, dan, and some other people are talking about in tutorials, so i decided to try to make my own. im not sure if this is the right way to go about it, or if this way will cause problems with trying to do some things in the game. it works, but im not sure if it the right way to do it...


var chars : array char of boolean
var circlex, circley : int := 100
var radius : int := 20

colorback (black)
cls

loop
    setscreen ("offscreenonly")
    View.Update
    drawfillbox (20, 20, maxx - 20, maxy - 20, brightred)
    drawfilloval (circlex, circley, radius, radius, black)
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        if circley + radius > maxy - 20 then
            circley := circley - 1
        else
            circley := circley + 1
        end if
    elsif chars (KEY_DOWN_ARROW) then
        if circley + radius < 60 then
            circley := circley + 1
        else
            circley := circley - 1
        end if
    elsif chars (KEY_LEFT_ARROW) then
        if circlex + radius < 60 then
            circlex := circlex + 1
        else
            circlex := circlex - 1
        end if
    elsif chars (KEY_RIGHT_ARROW) then
        if circlex + radius > maxx - 20 then
            circlex := circlex - 1
        else
            circlex := circlex + 1
        end if
    end if
end loop


if the brevity of the code is not very good, oh well.

-----------------------------------
Paul
Sun Feb 01, 2004 4:49 pm


-----------------------------------
oh, so you used the size of the walls? I was just thinking about how to do it with whatdotcolor, you know, the only thing I've thought up of is if a color drawn over that doesnt belong there, then change the coords.

-----------------------------------
recneps
Sun Feb 01, 2004 4:50 pm


-----------------------------------
that works. thats basically the "rectangle" because you've made an invisible rectangle around the whole screen area, eg i show as a drawbox ;p

drawbox(0,0,maxx,maxy,7)

thats basically your box. and when it hits the edge of that box, its gonna go back one rather than forward, according to your code.

-----------------------------------
Paul
Sun Feb 01, 2004 4:55 pm


-----------------------------------
Jonos, you won't  mind if I leech off your post right? It has to do with the same thing. Can anyone tell me how to do collision detection with whatdotcolor?

-----------------------------------
jonos
Sun Feb 01, 2004 4:57 pm


-----------------------------------
ill try it with whatdotcolor right now, hold on ten mins. i don't care if you leach off mine, i leached off your title colors  :D

-----------------------------------
recneps
Sun Feb 01, 2004 5:00 pm


-----------------------------------
have your walls say, black,....
drawbox(x,y,x2,y2,black)

and your car, say, red
drawoval(x,y,rad,rad,red)

and
if whatdotcolour(x[car]+rad,y[car]+rad) = black then
collision=true
end if

-----------------------------------
jonos
Sun Feb 01, 2004 5:06 pm


-----------------------------------

var chars : array char of boolean
var circlex, circley : int := 100
var radius : int := 20

colorback (black)
cls

loop
    setscreen ("offscreenonly")
    View.Update
    drawfillbox (20, 20, maxx - 20, maxy - 20, 12)
    drawfilloval (circlex, circley, radius, radius, white)
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        if whatdotcolor (circlex, circley + radius + 2) = 12 then
            circley := circley + 1
        else
            circley := circley - 1
        end if
    elsif chars (KEY_DOWN_ARROW) then
        if whatdotcolor (circlex, circley + radius + 2) = 12 then
            circley := circley - 1
        else
            circley := circley + 1
        end if
    elsif chars (KEY_LEFT_ARROW) then
        if whatdotcolor (circley, circlex + radius + 2) = 12 then
            circlex := circlex - 1
        else
            circlex := circlex + 1
        end if
    elsif chars (KEY_RIGHT_ARROW) then
        if whatdotcolor (circley, circlex + radius + 2) = 12 then
            circlex := circlex + 1
        else
            circlex := circlex - 1
        end if
    end if
end loop

this is what i got, but it still doesn't work perfectly, i hope no one beat me to it. play around with it paulbian and maybe you can get it to work.,

-----------------------------------
Andy
Sun Feb 01, 2004 5:08 pm


-----------------------------------
your approach only works for mono colored things... what u should do is check to the direction of movement...

-----------------------------------
Paul
Sun Feb 01, 2004 5:10 pm


-----------------------------------
Im thinking of doing one of those obstacle courses where you have to manuver the ball, which the size you can change, but the the smaller it is the faster it gets, through a tube that has different sized sections. Just to get familiar with collision detection. To me that's where whatdotcolor could be useful.

-----------------------------------
jonos
Sun Feb 01, 2004 5:10 pm


-----------------------------------
can you help us please, cause what i gave doesn't even work, it stops in a place where it shouldn't.

-----------------------------------
jonos
Sun Feb 01, 2004 5:17 pm


-----------------------------------

var chars : array char of boolean
var circlex, circley : int := 100
var radius : int := 20

colorback (black)
cls

loop
    setscreen ("offscreenonly")
    View.Update
    drawfillbox (20, 20, maxx - 20, maxy - 20, 12)
    drawfilloval (circlex, circley, radius, radius, white)
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        if whatdotcolor (circlex + radius + 1, circley + radius + 1) not= 7 then
            circley := circley + 1
        else
            circley := circley - 1
        end if
    elsif chars (KEY_DOWN_ARROW) then
        if whatdotcolor (circlex + radius + 1, circley - radius - 1) not= 7 then
            circley := circley - 1
        else
            circley := circley + 1
        end if
    elsif chars (KEY_LEFT_ARROW) then
        if whatdotcolor (circley + radius + 1, circlex - radius - 1) not= 7 then
            circlex := circlex - 1
        else
            circlex := circlex + 1
        end if
    elsif chars (KEY_RIGHT_ARROW) then
        if whatdotcolor (circley + radius + 1, circlex + radius + 1) not= 7 then
            circlex := circlex + 1
        else
            circlex := circlex - 1
        end if
    end if
end loop

just one small thing to fix cause the circle stops in this one place on the y axis all the time

-----------------------------------
Paul
Sun Feb 01, 2004 5:21 pm


-----------------------------------
I just made a minor change to the if structure, cause you used elsif, it doesnt move diagonally.

var chars : array char of boolean
var circlex, circley : int := 100
var radius : int := 20

colorback (black)
cls

loop
    setscreen ("offscreenonly")
    View.Update
    drawfillbox (20, 20, maxx - 20, maxy - 20, 12)
    drawfilloval (circlex, circley, radius, radius, white)
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        if whatdotcolor (circlex + radius + 1, circley + radius + 1) not= 7 then
            circley := circley + 1
        else
            circley := circley - 1
        end if
    end if
    if chars (KEY_DOWN_ARROW) then
        if whatdotcolor (circlex + radius + 1, circley - radius - 1) not= 7 then
            circley := circley - 1
        else
            circley := circley + 1
        end if
    end if
    if chars (KEY_LEFT_ARROW) then
        if whatdotcolor (circley + radius + 1, circlex - radius - 1) not= 7 then
            circlex := circlex - 1
        else
            circlex := circlex + 1
        end if
    end if
    if chars (KEY_RIGHT_ARROW) then
        if whatdotcolor (circley + radius + 1, circlex + radius + 1) not= 7 then
            circlex := circlex + 1
        else
            circlex := circlex - 1
        end if
    end if
end loop



-----------------------------------
jonos
Sun Feb 01, 2004 5:24 pm


-----------------------------------
yeah, i was trying some stuff to make it go diagonal, thanks. i got it working, i just had to make the window smaller, which probably isn't the best way to do it, but whatever

var chars : array char of boolean
var circlex, circley : int := 100
var radius : int := 20

setscreen ("offscreenonly")
setscreen ("graphics:400;400")
colorback (black)
cls

loop
    View.Update
    drawfillbox (20, 20, maxx - 20, maxy - 20, 12)
    drawfilloval (circlex, circley, radius, radius, white)
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        if whatdotcolor (circlex + radius + 1, circley + radius + 1) not= 7 then
            circley := circley + 1
        else
            circley := circley - 1
        end if
    elsif chars (KEY_DOWN_ARROW) then
        if whatdotcolor (circlex + radius + 1, circley - radius - 1) not= 7 then
            circley := circley - 1
        else
            circley := circley + 1
        end if
    elsif chars (KEY_LEFT_ARROW) then
        if whatdotcolor (circley - radius - 1, circlex - radius - 1) not= 7 then
            circlex := circlex - 1
        else
            circlex := circlex + 1
        end if
    elsif chars (KEY_RIGHT_ARROW) then
        if whatdotcolor (circley + radius + 1, circlex + radius + 1) not= 7 then
            circlex := circlex + 1
        else
            circlex := circlex - 1
        end if
    end if
end loop

maybe someone will know how to do it better.

-----------------------------------
TheXploder
Sun Feb 01, 2004 5:32 pm


-----------------------------------
it's still wierd somethimes the up button make it move through the wall or the up button makes it move down.. really weird, and I've never see anyone do collisions with whatdotcolour...

-----------------------------------
jonos
Sun Feb 01, 2004 5:35 pm


-----------------------------------
yeah, i see what you mean, i think it's just turing though, because i don't see how it could be wrong. ive thought it over pretty hard  :(

-----------------------------------
McKenzie
Sun Feb 01, 2004 5:35 pm


-----------------------------------
your checks are wrong. e.g. you have:
elsif chars (KEY_LEFT_ARROW) then 
        if whatdotcolor (circley, circlex + radius + 2) = 12 then 
if you are looking left it should be the point (circlex - radius -1, circley)

-----------------------------------
Paul
Sun Feb 01, 2004 5:36 pm


-----------------------------------
I got my whatdotcolor collision working, it works fine.

setscreen ("offscreenonly")
var x, y : int
x := 100
y := 100
var addx, addy : int := 0
var chars : array char of boolean

loop
    drawfillbox (0, 0, maxx, maxy, black)
    drawfillbox (10, 10, maxx - 10, maxy - 10, 0)

    Input.KeyDown (chars)

    if chars (KEY_UP_ARROW) then
        if whatdotcolor (x, y + 11 + addy) = 0
                then
            y := y + 5
        end if
    end if
    if chars (KEY_RIGHT_ARROW) then
        if whatdotcolor (x + 11 + addx, y) = 0 then
            x := x + 5
        end if
    end if
    if chars (KEY_LEFT_ARROW) then
        if whatdotcolor (x - 11 - addx, y) = 0 then
            x := x - 5
        end if
    end if
    if chars (KEY_DOWN_ARROW) then
        if whatdotcolor (x, y - 11 - addy) = 0 then
            y := y - 5
        end if
    end if

    drawfilloval (x, y, addx + 10, addy + 10, red)
    View.Update
    delay (10)
    cls
    if chars (KEY_ENTER) then
        addx := addx + 5
        addy := addy + 5
    end if
    if chars (KEY_BACKSPACE) then
        addx := addx - 5
        addy := addy - 5
    end if
end loop

Mine grows and shrinks too  :lol:

Edit
I deleted the below post because I feared the wrath of AsianSensation.

-----------------------------------
Cervantes
Sun Feb 01, 2004 5:36 pm


-----------------------------------
collisions with whatdotcolour are the first way I learned to do them..
however, whatdotcolour isn't as good as going it with coords in some instances, in other instances whatdotcolour is the only way to go :)

to make it go diagonal..

var chars : array char of boolean
var circlex, circley : int := 100
var radius : int := 20

setscreen ("offscreenonly")
setscreen ("graphics:400;400")
colorback (black)
cls

loop
    View.Update
    drawfillbox (20, 20, maxx - 20, maxy - 20, 12)
    drawfilloval (circlex, circley, radius, radius, white)
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        if whatdotcolor (circlex + radius + 1, circley + radius + 1) not= 7 then
            circley := circley + 1
        else
            circley := circley - 1
        end if
    end if
    if chars (KEY_DOWN_ARROW) then
        if whatdotcolor (circlex + radius + 1, circley - radius - 1) not= 7 then
            circley := circley - 1
        else
            circley := circley + 1
        end if
    end if
    if chars (KEY_LEFT_ARROW) then
        if whatdotcolor (circley - radius - 1, circlex - radius - 1) not= 7 then
            circlex := circlex - 1
        else
            circlex := circlex + 1
        end if
    end if
    if chars (KEY_RIGHT_ARROW) then
        if whatdotcolor (circley + radius + 1, circlex + radius + 1) not= 7 then
            circlex := circlex + 1
        else
            circlex := circlex - 1
        end if
    end if
end loop

the difference being that I got rid of the elsif's and replaces them with if's.  before, if the uparrow was being pressed, it would never ask whether any of the other keys were being pressed.  this way it will :)

-----------------------------------
McKenzie
Sun Feb 01, 2004 5:37 pm


-----------------------------------
:oops: I type too slow.

-----------------------------------
Paul
Sun Feb 01, 2004 5:47 pm


-----------------------------------
I tried to get the growing shrinking thing to be restricted by the wall too, using the same principle, but it didn't work.

-----------------------------------
jonos
Sun Feb 01, 2004 5:51 pm


-----------------------------------
thanks mckenzie, that really helped, don't know why i didn't see it  :oops: 

for the growing circle couldn't you just go:
[code]
if circlex+radius+1 or circlex -radius-1 or circley+radius +1 or circley -radius -1 = [the wall color] then
   radius-1 or radius+1
else
   do nothing
end if

that may not be right haven't tested it.l

-----------------------------------
Cervantes
Sun Feb 01, 2004 5:53 pm


-----------------------------------
where you have the 
    if chars (KEY_ENTER) then 
        addx := addx + 5 
        addy := addy + 5 
    end if 


you should alter add an if statement in there

    if chars (KEY_ENTER) then 
        addx := addx + 5 
        addy := addy + 5 
        if x > maxx - 20 then
              x -= 5
        end if
        if x < 20 then
              x += 5
        end if
        if y > maxy - 20 then
              y -= 5
        end if
        if y < 20 then
              y += 5
        end if
    end if 

do the same thing with y

if you want to do collisions with whatdotcolour then you can do that as well, you just have to implement it into the spots in that code up there where I put things like "if y > maxx - 20 then"

Cheers

-----------------------------------
Cervantes
Sun Feb 01, 2004 5:56 pm


-----------------------------------

if circlex+radius+1 or circlex -radius-1 or circley+radius +1 or circley -radius -1 = 

jonos an if statement does not need to have an else.  ex of that is your code modified by me so that it can go on a diagonal.  sometimes else is useful though, but if its 
else
   do nothing
end if
then just ditch the else.

Cheers

-----------------------------------
jonos
Sun Feb 01, 2004 6:06 pm


-----------------------------------
yeah, i know that, don't know why i put that. i probably though of putting something there but then decided against it.

-----------------------------------
Paul
Sun Feb 01, 2004 6:07 pm


-----------------------------------
I tried it, using and instead of or and it works!

setscreen ("offscreenonly")
var x, y : int
x := 100
y := 100
var addx, addy : int := 0
var chars : array char of boolean

loop
    drawfillbox (0, 0, maxx, maxy, black)
    drawfillbox (10, 10, maxx - 10, maxy - 10, 0)

    Input.KeyDown (chars)

    if chars (KEY_UP_ARROW) then
        if whatdotcolor (x, y + 11 + addy) = 0
                then
            y := y + 5
        end if
    end if
    if chars (KEY_RIGHT_ARROW) then
        if whatdotcolor (x + 11 + addx, y) = 0 then
            x := x + 5
        end if
    end if
   if chars (KEY_LEFT_ARROW) then 
        if whatdotcolor (x-11-addx, y ) = 0 then 
            x := x - 5 
        end if 
    end if
    if chars (KEY_DOWN_ARROW) then
        if whatdotcolor (x, y - 11 - addy) = 0 then
            y := y - 5
        end if
    end if

    if chars (KEY_ENTER) then
        if whatdotcolor (x + addx + 6, y) = 0 and whatdotcolor (x - addx - 6, y) = 0 and
                whatdotcolor (x, y + addy + 6) = 0 and whatdotcolor (x, y - addy - 6) = 0 then
            addx := addx + 5
            addy := addy + 5
        end if
    end if
    if chars (KEY_BACKSPACE) then
        if whatdotcolor (x + addx + 6, y) = 0 and whatdotcolor (x - addx - 6, y) = 0 and
                whatdotcolor (x, y + addy + 6) = 0 and whatdotcolor (x, y - addy - 6) = 0 then
            addx := addx - 5
            addy := addy - 5
        end if
    end if
    drawfilloval (x, y, addx + 10, addy + 10, red)
    View.Update
    delay (10)
    cls
end loop


He didn't delete, I just deleted it, fearing his wrath.

-----------------------------------
jonos
Sun Feb 01, 2004 6:13 pm


-----------------------------------
there are still things wrong with it, and i can't find it and don't want to spend time doing it. if you blow it up and move it left, then it can still get through, as well as if you keep playing around with it it will do the same for the other walls. ahhhh, this is confusing :D

-----------------------------------
Cervantes
Sun Feb 01, 2004 6:14 pm


-----------------------------------
oh lol, I just deleted my post sense i saw your post reappear.

(you can delete this and 2 bits if you want Asian :eh:)

-----------------------------------
Paul
Sun Feb 01, 2004 6:15 pm


-----------------------------------
yea, I noticed that left wall thing to, I fixed that line.

-----------------------------------
Cervantes
Sun Feb 01, 2004 6:20 pm


-----------------------------------
for things like this I prefer to use coordinates rather than whatdotcolour in terms of collision
setscreen ("offscreenonly")
var x, y : int
x := 100
y := 100
var addx, addy : int := 0
var chars : array char of boolean

loop
    drawfillbox (0, 0, maxx, maxy, black)
    drawfillbox (10, 10, maxx - 10, maxy - 10, 0)

    Input.KeyDown (chars)

    if chars (KEY_UP_ARROW) then
        if whatdotcolor (x, y + 11 + addy) = 0
                then
            y := y + 5
        end if
    end if
    if chars (KEY_RIGHT_ARROW) then
        if whatdotcolor (x + 11 + addx, y) = 0 then
            x := x + 5
        end if
    end if
    if chars (KEY_LEFT_ARROW) then
        if whatdotcolor (x - 11 + addx, y) = 0 then
            x := x - 5
        end if
    end if
    if chars (KEY_DOWN_ARROW) then
        if whatdotcolor (x, y - 11 - addy) = 0 then
            y := y - 5
        end if
    end if
    if chars (KEY_ENTER) then
        addx := addx + 5
        addy := addy + 5
        if x > maxx - x - addx - 15 then
            x -= 5
        end if
        if x < 0 + x + addx + 15 then
            x += 5
        end if
        if y > maxy - y - addy - 15 then
            y -= 5
        end if
        if y < 0 + y + addy + 15 then
            y += 5
        end if
    end if

    if chars (KEY_BACKSPACE) then
        addx := addx - 5
        addy := addy - 5
    end if

    drawfilloval (x, y, addx + 10, addy + 10, red)
    View.Update
    delay (10)


    cls
end loop

that's still slightly buggy..

the + 15 or the - 15  in this part

        if x > maxx - x - addx - 15 then
            x -= 5
        end if

10 because you did drawfilloval (x,y,addx + 10, addy + 10, red) and 5 because that's how much you add every time enter or backspace is hit.  the 5 is prevention.

Keep playing around with it and we can iron out all the bugs.

EDIT: the bug in this code is that it works fine for the first wall that you got to, but then any of the other walls you go to its buggy...

-----------------------------------
Andy
Sun Feb 01, 2004 6:25 pm


-----------------------------------
however, whatdotcolour isn't as good as going it with coords in some instances, in other instances whatdotcolour is the only way to go :)


cervantes, how much bits do u want to lose? whatdotcolor is ALWAYS i repeat ALWAYSE the way to go!!!! and not in some instances, nonono, in ALL i repeat ALL instances, whatdotcolor is the only way to not go, LIVE.

-5 bits btw

-----------------------------------
Paul
Sun Feb 01, 2004 6:25 pm


-----------------------------------
crap, I edited the wrong line, I edited it back now. Theres a bug that when you expand while moving, it goes into the wall.

-----------------------------------
Cervantes
Sun Feb 01, 2004 6:32 pm


-----------------------------------
okay okay dodge I repent I repent!  hail whatdotcolour!!  whatdotcolour is the way to go! It's the way to live!  All hail whatdotcolour!!  The Turing command that elevates Turing beyond C++ for gaming and all other purposes!
:)

-----------------------------------
Andy
Sun Feb 01, 2004 6:34 pm


-----------------------------------
gj, plus another 10 bits lol

-----------------------------------
Paul
Sun Feb 01, 2004 6:35 pm


-----------------------------------
Yes, whatdotcolor IS the greatest thing ever, it changed my life, otherwise I might not understand collision at all. I'll go and reccommend it to all my friends now. *nudge*

-----------------------------------
Cervantes
Sun Feb 01, 2004 6:41 pm


-----------------------------------
woot!  I'm getting the hang of this religion now :)  

Paulbian I'll have my own style of your program up in a bit.

-----------------------------------
shorthair
Sun Feb 01, 2004 6:46 pm


-----------------------------------
dodge is being sweet talked every way till sunday , i think a labrinth marble game , would be hte best way to put collision detection to the test  ,also becuase you would hav etrue phyics involved , wow i jsut bouht 3dsMax and im lost , the book is 790 pages , its insane in the membrane wanna know why......." its the beginers guide " , someone better make a what dot color tutorial , everyone asks aboutit at least once in their compsci life ( well most )  ,dodge this would be cool of you to do since your like the god of it and what not

-----------------------------------
Andy
Sun Feb 01, 2004 6:50 pm


-----------------------------------
ok well since ccc is coming up, for every problem on there that some one does with whatdotcolor in a cool way, i will award 20 bits*question number
s4 counts as 6 s5 as 7

-----------------------------------
recneps
Sun Feb 01, 2004 6:53 pm


-----------------------------------
whats CCC?

-----------------------------------
Andy
Sun Feb 01, 2004 6:57 pm


-----------------------------------
waterloo's canadian computing contest

-----------------------------------
shorthair
Sun Feb 01, 2004 7:03 pm


-----------------------------------
go look in contests and im sur there is a sticky with everything about it by tony or someone , its really interesting , you ca end up programming overseas for waterloo , well 4 peopel in canada will be

-----------------------------------
recneps
Sun Feb 01, 2004 7:04 pm


-----------------------------------
Verrrry Interesting :D

-----------------------------------
Andy
Sun Feb 01, 2004 7:06 pm


-----------------------------------
4? more like 20

-----------------------------------
shorthair
Sun Feb 01, 2004 7:08 pm


-----------------------------------
for the final amount , i htought it was like 4 , wow ther eteam is that big , didnt bugz make round 2 last year the one at waterloo

-----------------------------------
Andy
Sun Feb 01, 2004 7:10 pm


-----------------------------------
yea so did another massey kid, but he didnt want to go... he's at MIT now

-----------------------------------
Cervantes
Sun Feb 01, 2004 7:20 pm


-----------------------------------
what compsci knowledge should you have for this CCC?  full highschool knowledge?

Paulbian here's my version of your program, flawless if I might add.  and in the spirit of my conversion to whatdotcolour I have utilized whatdotcolour in said program 8)

setscreen ("offscreenonly")
var x : int := maxx div 2
var y : int := maxy div 2
var xr, yr : int := 10 %x radius, y radius
var move : boolean := true % this fixes a small bug, if you want to see what that bug is, delete all the move stuff ;)
var chars : array char of boolean
loop
    drawfillbox (0, 0, maxx, maxy, black)
    drawfillbox (10, 10, maxx - 10, maxy - 10, 0)

    Input.KeyDown (chars)

    %controls
    if move = true then
        if chars (KEY_UP_ARROW) then
            y += 2
        end if
        if chars (KEY_DOWN_ARROW) then
            y -= 2
        end if
        if chars (KEY_LEFT_ARROW) then
            x -= 2
        end if
        if chars (KEY_RIGHT_ARROW) then
            x += 2
        end if
    end if

    %collision whatdotcolour style!!   woot!! ;)
    if whatdotcolour (x - xr, y) = black then
        x += 2
    end if
    if whatdotcolour (x + xr, y) = black then
        x -= 2
    end if
    if whatdotcolour (x, y - yr) = black then
        y += 2
    end if
    if whatdotcolour (x, y + yr) = black then
        y -= 2
    end if

    %circle growing and shrinking
    move := true 
    if chars (KEY_ENTER) then
        xr += 2
        yr += 2
        move := false
    end if
    if chars (KEY_BACKSPACE) then
        xr -= 2
        yr -= 2
    end if

    %keep the growth under control!!!! aaaaugh!!!
    if xr < 4 or yr < 4 then
        xr := 4
        yr := 4
    end if

    if xr > maxy div 2 or yr > maxy div 2 then
        xr := maxy div 2
        yr := maxy div 2
    end if


    drawfilloval (x, y, xr, yr, red)
    View.Update
    delay (2)
end loop

btw, just to clarify, do you know what this means?

x += 2

-----------------------------------
Paul
Sun Feb 01, 2004 7:21 pm


-----------------------------------

x:=x+2

either that or
1+1=3

-----------------------------------
Paul
Sun Feb 01, 2004 7:24 pm


-----------------------------------
Do this with your program, run it, at the start hold down 3 keys:
up arrow, right arrow, and enter.
release the keys when its grown all it can grow
then hold up key.
flawless?

-----------------------------------
shorthair
Sun Feb 01, 2004 7:25 pm


-----------------------------------
2 + 2 = 5 , in really big instances of 2 , and about ccc , if your gonna d ojunior ( which stops at het first round , you can do it in turing i did really well  ) if your doin senior you need to know another language it costs me 5 $ t oenter the senior just for hte heck of it , i just like the time off school and te chalenge , no where near good enough tomake it out of the  school to round 2 ,

-----------------------------------
Cervantes
Sun Feb 01, 2004 7:37 pm


-----------------------------------
*tapes Paulbian's mouth shut like so -->  :Silenced: *

flawless indead! :)
also 
x += 2 
is the same as
 x := x + 2 
correct

the reason that is doing that is because I used whatdotcolour and I am not experienced enough yet...  the other way I did it, like so

if x < 0 + xr + 10 then
     x += 2
end if
if x > maxx - xr - 10 then
     x -= 2
end if
if y < 0 + yr + 10 then
     y += 2
end if
if y > maxy - yr - 10 then
     y -= 2
end if

worked fine for that..  it would work with whatdotcolour too but the boarder doesn't go outside the screen, the boarder is pretty thin.

:think: I'm going to need instruction in the ways of whatdotcolour here dodge. :eh:
