
-----------------------------------
Vertico
Fri Apr 08, 2005 12:59 pm

Need help with first game
-----------------------------------
problem : i want 2 know how i score. i want a point when the wepon (green oval) hits the white oval at the top of the screen. iv tryed and have failed.

i know alot of u can find other problems with my game, like places it could be shortened or were i completly screwed up. but i would like 2 figure out how i code it so i can have score keeping.

plz help me out


colourback (black)
colour (black)
cls

setscreen ("graphics : 600 ; 300")

var Ax, Ay, Astep, radius, Vx, Vy, By, score : int
var key, wep : string (1)
key := ""
wep := ""
radius := 5
Vx := 5
Vy := 5
By := Vy
Ax := 5
Ay := 388
Astep := 5
score := 0

%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%Moster
%%%%%%%%%%%%%%%%%%%%%%%%%%

loop
  color(yellow)
locate(5,30)
put "Score : " , score
color(black)

  %%%Vertico%%%
    drawfilloval (Vx, Vy, radius, radius, blue)
    %%%Moster%%%
    drawfilloval (Ax, Ay, radius+10, radius+10, white)
    delay (10)
    %%%Vertico%%%
    drawfilloval (Vx, Vy, radius, radius, black)
    %%%Moster%%%
    drawfilloval (Ax, Ay, radius+10, radius+10, black)

    %%%Aliens movment.  back and foreth at the top of screen
    Ax := Ax + Astep
    if Ax > 630 - radius then
        Astep := -Astep
    elsif Ax  630 - radius then
                    Astep := -Astep
                elsif Ax  600
                By := By + 5
                if whatdotcolor  (Vx, By) = white then
                score := score + 1
                end if 
                end loop
        end if 
        if Vx = 630 then
        Vx := 630 + radius
        end if
        if Vy = 390 then
        Vy := 390 + radius
        end if 
    end if
end loop

-----------------------------------
person
Fri Apr 08, 2005 1:13 pm


-----------------------------------
use whatdotcolor for collision detection

and to count how many hits....

use a counter

-----------------------------------
Vertico
Fri Apr 08, 2005 4:17 pm


-----------------------------------
i understand that. but i dont know how 2 use whatdotcolor. i think i used it wrong for what i need

-----------------------------------
Bacchus
Sat Apr 09, 2005 1:06 am


-----------------------------------
for this a i think pythagoras is much better that whatdotcolor (btw its used whatdotcolor(x,y:int) and returns the color at that point) cause unless you want to use a lot of checks to check all areas of the circle for that color... no use pythagoras u kno a^2+b^2=c^2 but ill leave more of that for you to figure out :P
