• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

whats wrong with my collision?

Dubbsta

Active member
Joined
Jul 13, 2017
Messages
208
ive done this a hundred times now and cant see whats wrong...can someone spot it?
i get no reaction

forgot how to put the better codebox

Code:
Class Icon

Field iconimg:Image[16]

Field y:Int[16]

Field x:Int[16]



Method New()

For Local i:Int = 0 Until iconimg.Length

iconimg[i] = LoadImage("gfx/pieces/icons200/icon" + String(i) +".png",

1,Image.MidHandle)



x[i] = CENTERX

y[i] = CENTERY + i * 250

End

End



Method draw:Void()

'SetAlpha fade

For Local i:int = 0 Until iconimg.Length

DrawImage(iconimg[i],x[i],y[i] ,0)



DrawText(y[i],100, 300 +i *30)



End



DrawText(MouseX() ,300, 300 )

DrawText( MouseY(),300, 330 )

End

End



Class IconSelectScrn



Field icon:Icon

Field scrntitle:Image

Field next_btn:Button

Field nextscrn:Int





Method New()

icon = New Icon()



scrntitle = LoadImage("selecticon.png",1,Image.MidHandle)

next_btn = New Button("gfx/menu/buttons/next_btn.png",

DeviceWidth() - 180,DeviceHeight() - 180,3)

End





Method pressed:Void()

If next_btn.coll(next_btn)

next_btn.frame = 1

nextscrn = 1

Else

next_btn.frame = 0

nextscrn = 0

End

End





Method selected:Bool()

For Local i:Int = 0 Until icon.iconimg.Length



If MouseX() < icon.x[i] - icon.iconimg[i].Width() * .5 Or

MouseX() > icon.x[i] + icon.iconimg[i].Width() * .5 Return False



If MouseY() < icon.y[i] - icon.iconimg[i].Height() * .5 Or

MouseY() > icon.y[i] + icon.iconimg[i].Height() * .5 Return False

End

Return True



End





Method scroll:Void()



For Local i:Int = 0 Until icon.iconimg.Length()



icon.y[i] -= 5



If icon.y[i] <= 350

icon.y[i] = icon.y[i] +

icon.iconimg.Length() * 250



End

End



selected()

End
 
Last edited by a moderator:
Your selected() statement in line 170 is never reached as it is outside any method. I guess you don't use Strict inside your code, so maybe the compiler never catches this.

Btw. Do you indent your code properly and it just got destroyed when you inserted inside your post?
 
thanks mike i just solved it with a different approach took me a day and a half

yes i cut and pasted and it messed the indenting up
 
Back
Top Bottom