[Monkey] Mousehit Mousedown etwas missbrauchen
Übersicht

![]() |
DottakopfBetreff: Mousehit Mousedown etwas missbrauchen |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hallo Blitzer,
vielleich ist es einfach zu früh am morgen aber irgendwie stell ich mich gerade doof an. ich habe einige simple Buttons(images) wenn man drauf drückt soll das nächste Menü geladen werden... Easy Nun will ich es aber etwas lebendiger mit minimalsten aufwand(also ohne eine extra Funktion) machen. Es soll für einen kurzen augenblick der Butten "markiert"(zweites Image) werden, und erst dann erst weiter. Nun dachte ich mir ich missbrauche die Mousehit und Mousedown eigenschaften etwas. Mousedown -> markierung wird gezeichnet Mosuehit -> sobalt taste losgelassen wird änderung durchgeführt genial, oder trottelig.... ![]() ![]() Hat das einer schon so simpel gemacht oder werd ich mir "States" für den Button coden müssen, weil es einfach so nicht geht ? Hier in dem Beispiel sieht man das Mousehit leider schon ausgelöst wird wenn mann es drückt, nicht erst wenn man es loslässt.. hmm irgendwer eine Idee ![]() (Rot = normal, Grün = gedrückt) Richtig wäre.. erst grün dann zu Rot und andere Pos.. Code: [AUSKLAPPEN] Import mojo Global MHit:Int Global MDown:Int Global GameState:Int Function Main() New Game() End Class Game Extends App 'summary:The OnCreate Method is called when mojo has been initialized and the application has been successfully created. Method OnCreate() 'Set how many times per second the game should update and render itself SetUpdateRate(60) End 'summary: This method is automatically called when the application's update timer ticks. Method OnUpdate() MHit = 0 MDown = 0 If MouseHit() Then MHit = 1 If MouseDown() Then MDown = 1 End 'summary: This method is automatically called when the application should render itself, such as when the application first starts, or following an OnUpdate call. Method OnRender() Cls() SetColor 255, 0, 0 If MDown = 1 Then SetColor 0, 255, 0 If MHit = 1 Then GameState += 1 If GameState > 1 Then GameState = 0 If GameState = 0 Then DrawRect(0, 0, 128, 128) Else DrawRect(100, 100, 128, 128) EndIf End 'summary: This method is called instead of OnRender when the application should render itself, but there are still resources such as images or sounds in the process of being loaded. Method OnLoading() End 'summary: This method is called when the application's device window size changes. Method OnResize() End '#REGION Code to handle susped status of the game goes here 'summary: OnSuspend is called when your application is about to be suspended. Method OnSuspend() End 'summary: OnResume is called when your application is made active again after having been in a suspended state. Method OnResume() End '#END REGION '#REGION Code to handle game closing goes here: 'summary: This method is called when the application's 'close' button is pressed. Method OnClose() Super.OnClose() End 'summary:This method is called when the application's 'back' button is pressed. Method OnBack() Super.OnBack() End '#END REGION End Danke ! Gruß Dottakopf |
||
Rechtschreibfehler gelten der allgemeinen Belustigung! |
![]() |
Jolinah |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hallo Dottakopf,
wäre sowas nicht einfacher? Nur Pseudocode: Code: [AUSKLAPPEN] MDown = MouseDown()
If pressed = 0 And MDown = 1 Then pressed = 1 SetColor 0, 255, 0 ElseIf pressed = 1 And MDown = 0 Then pressed = 0 SetColor 255, 0, 0 GameState += 1 If GameState > 1 Then GameState = 0 EndIf |
||
![]() |
Dottakopf |
![]() Antworten mit Zitat ![]() |
---|---|---|
![]() |
||
Rechtschreibfehler gelten der allgemeinen Belustigung! |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group