I'm tired and feeling dumb and need assistance.
Trying to add some meanies to my game.
Type "meanie" all set up etc, but I'm stupidly stuck trying to actually create and render them.
Here's my meanies.bb which is included from the main program:
Here's the relevant excerpt from the main program:
I get an illegal type conversion where the main program tried to create a meanie.
I know, it's probably obvious. I'm just too tired to know what it is I need to change :)
Trying to add some meanies to my game.
Type "meanie" all set up etc, but I'm stupidly stuck trying to actually create and render them.
Here's my meanies.bb which is included from the main program:
Global num_meanies%=0 Const MEANIE_BIGSPHERE = 1 Const MEANIE_MEDIUMSPHERE = 2 Const MEANIE_SMALLSPHERE = 3 Type meanie Field typeof% Field x# Field y# Field dx# Field dy# Field hue# Field hitpoints% End Type Function add_meanie.meanie(this.meanie,meanie%,x#=0,y#=0) If (x#=0 And y#=0) angle#=Rnd#(0,359.99) radius#=GraphicsHeight()/2 ; !! Need to change for wide displays. x#=(Sin(angle#)*radius#)+(GraphicsWidth()/2) y#=(Cos(angle#)*radius#)+(GraphicsHeight()/2) EndIf Select meanie% Case MEANIE_BIGSPHERE this.meanie = New meanie this\typeof% = MEANIE_BIGSPHERE this\x# = x# this\y# = y# this\dx# = Rnd#(-.5,.5) this\dy# = Rnd#(-.5,.5) this\hue# = 0 this\hitpoints% = 50 num_meanies% = num_meanies+1 End Select Return this End Function Function render_meanies(this.meanie) For this.meanie = Each meanie this\x#=this\x#+this\dx# this\y#=this\y#+this\dy# Oval this\x#,this\y#,128,128,True Next End Function
Here's the relevant excerpt from the main program:
While Not (KeyHit(KEY_ESC) Or KeyHit(KEY_3) Or KeyHit(KEY_NUM_3)) If Rand(0,49)=0 menu.meanie = add_meanie(MEANIE_BIGSPHERE) EndIf render_meanies(menu) render_menu(MENU_MAIN) Flip Cls Wend
I get an illegal type conversion where the main program tried to create a meanie.
I know, it's probably obvious. I'm just too tired to know what it is I need to change :)