I'm having right grief getting my head round types.
i understand oop and methods and classes and everything, but i just can't seem to apply it in blitz plus.
im trying to create a list of "skeets" (like clay pigeons) that fly across the screen at random intervals, with random images (small, medium or large), at random heights, with random arcs etc etc etc.
heres what i have done:
Type skeet
Field ystart=Rnd(scrh/2,scrh-20) ;random starting height
Field xstart=-20 ;off screen until needed
Field speed = Rnd(1,10)
Field size = Rnd(1,3);will determine image to be used
Field curveheight ; i'll use trig to do this bit later
Field launch=Rnd(1,30000) launch time from start of round
Field idnum ;id number of skeet
End Type
For init = 1 To 150 ;create a list of 150 skeets
game.skeet=New skeet ;add a skeet
Next
;; this bit above seems to work ok. just to see if the skeets were displaying i did the following bit:
while not keydown(1)
cls
For game.skeet=Each skeet
DrawImage med,game/x,game/y
;;"med" is the image handle for the medium size skeet
game/x=game/x+game/speed
;; update the positions
Next
wend
when i run this i get "Expecting 'next' " at each of the slashes in the last two statements. I thought that maybe i had to use dot notation, but this resulted in a "type 'x' not found" error.
i know im probably missing something obvious, but i cant see it for looking. can anyone help me please?
El Neil
i understand oop and methods and classes and everything, but i just can't seem to apply it in blitz plus.
im trying to create a list of "skeets" (like clay pigeons) that fly across the screen at random intervals, with random images (small, medium or large), at random heights, with random arcs etc etc etc.
heres what i have done:
Type skeet
Field ystart=Rnd(scrh/2,scrh-20) ;random starting height
Field xstart=-20 ;off screen until needed
Field speed = Rnd(1,10)
Field size = Rnd(1,3);will determine image to be used
Field curveheight ; i'll use trig to do this bit later
Field launch=Rnd(1,30000) launch time from start of round
Field idnum ;id number of skeet
End Type
For init = 1 To 150 ;create a list of 150 skeets
game.skeet=New skeet ;add a skeet
Next
;; this bit above seems to work ok. just to see if the skeets were displaying i did the following bit:
while not keydown(1)
cls
For game.skeet=Each skeet
DrawImage med,game/x,game/y
;;"med" is the image handle for the medium size skeet
game/x=game/x+game/speed
;; update the positions
Next
wend
when i run this i get "Expecting 'next' " at each of the slashes in the last two statements. I thought that maybe i had to use dot notation, but this resulted in a "type 'x' not found" error.
i know im probably missing something obvious, but i cant see it for looking. can anyone help me please?
El Neil