New topic: Fun game to play
<http://forums.realsoftware.com/viewtopic.php?t=32167> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message Sky Stream Post subject: Fun game to playPosted: Sun Jan 24, 2010 12:24 pm Joined: Sun Nov 23, 2008 12:27 am Posts: 49 I remember writing this program a few years ago when I was trying to learn Dolphin smalltalk. Basically, its an application with 1 button. When you try to click on the button, the button moves. The other day I wrote it in Realbasic for my nephew to play. It kept him entertained for 30 minutes Code: Class App Inherits Application Const kEditClear = "&Delete" Const kFileQuit = "&Quit" Const kFileQuitShortcut = "" End Class Class Window1 Inherits Window Window1.MouseMove: Sub MouseMove(X As Integer, Y As Integer) if MouseX > (clickMeButton.left) then clickMeButton.left = clickMeButton.left - 4 end if if MouseX < (clickMeButton.left +clickMeButton.width) then clickMeButton.left = clickMeButton.left + 4 end if if MouseY > (clickMeButton.top) then clickMeButton.top = clickMeButton.top - 4 end if if MouseY < (clickMeButton.top + clickMeButton.height) then clickMeButton.top = clickMeButton.top + 4 end if // If button goes off screen, reset button to middle. if clickMeButton.left < 5 or clickMeButton.left > (window1.Width - clickMeButton.Width - 5) then clickMeButton.left = (window1.Width / 2) end if if clickMeButton.top < 5 or clickMeButton.top > (window1.Height - clickMeButton.height - 5) then clickMeButton.top = (window1.height / 2) end if End Sub Window1 Control clickMeButton: Sub Action() MsgBox "You Got Me!" End Sub End Class enjoy Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
