Page 1 of 1

Magic Emo Ball code

Posted: Wed Sep 16, 2009 8:31 pm
by Rook Zimbabwe
With huge thanks to Kaeru gama for the SHAKE code...

And absolutely simple 9 minute code project that uses the Magic 8 Ball idea but with a screwed up emo twist!

Code: Select all


; ***************************************
; **   EMO BALL 1.0                                         **
; * With extreme thanks to Kaeru Gaman!              *
; * (he heled me make is shake!!! )                       *
; ** (c) 2009 Ralph W Dunn                               **
; ***************************************


;- Window Constants
;
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
;
Enumeration
  #Image_0
  #Text_0
  #Button_SHAKE
EndEnumeration

;- Fonts

Define.l Shaker, EXIT
Define.l WinX, WinY
Define.i Event, EvGad

Global FontID1
FontID1=LoadFont(1, "Arial", 10, #PB_Font_Bold)
;- Image Plugins

Global Dim whine$(18)

whine$(0) = "Like I care..."
whine$(1) = "42"
whine$(2) = "Your village called, they miss their idiot and want you BACK!"
whine$(3) = "Whatever!"
whine$(4) = "WTF!, OMG!, Um... what was the question?"
whine$(5) = "You are really creeping me out so... NO!"
whine$(6) = "Absolutely.. Positivley... MAYBE!"
whine$(7) = "Oh GIVE IT UP!!!"
whine$(8) = "Didn't I tell you NO already?"
whine$(9) = "Signs point to: FORGETABOUTIT!!!"
whine$(10) = "OK!  (like I care...)"
whine$(11) = "SURE (Whatever bakes your brownies!)"
whine$(12) = "Ask me l8r when I have had my nap!"
whine$(13) = "QUIT BOTHERING ME... I don't know!"
whine$(14) = "I don't know... I make this crap up!"
whine$(15) = "YES, now quit whining!"
whine$(16) = "YOU DON'T UNDERSTAND... NOBODY DOES!!!"
whine$(17) = "I need a popsicle before I answer that!"
whine$(18) = "You are Skanky Twisted!!!"

UseJPEGImageDecoder()
;- Image Globals
Global Image0
;- Catch Images
Image0=CatchImage(0, ?Image0)

;- Images
DataSection
  Image0 : 
  IncludeBinary "MEB001.jpg"
EndDataSection

Procedure Open_Window_0()
  If OpenWindow(#Window_0, 254, 87, 440, 533, "MAGIC EMO BALL 0.1a", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
    ;WindowBounds(0, 200, 200, 400, 400)    
      ImageGadget(#Image_0, 10, 10, 420, 420, Image0, #PB_Image_Border)
      TextGadget(#Text_0, 10, 440, 420, 30, "Ask your question and then click SHAKE THE BALL!", #PB_Text_Center | #PB_Text_Border)
      SetGadgetFont(#Text_0, FontID1)
      ButtonGadget(#Button_SHAKE, 10, 480, 420, 50, "ASK YOUR QUESTION and SHAKE THE BALL")

  EndIf
EndProcedure

Open_Window_0()

Repeat ; Start of the event loop
  
  Event = WaitWindowEvent() ; This line waits until an event is received from Windows
  
  WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
  
  GadgetID = EventGadget() ; Is it a gadget event?
  
  EventType = EventType() ; The event type
  
  ;You can place code here, and use the result as parameters for the procedures
  
  If Event = #PB_Event_Gadget
    
      
    If GadgetID = #Button_SHAKE
    Shaker = 100
    WinX   = WindowX(0)
    WinY   = WindowY(0)
    pickit = Random(18)
    reply$ = whine$(pickit)
    SetGadgetText(#Text_0, reply$)  
    EndIf
    
  EndIf
  If Shaker > 1
    ResizeWindow( 0, WinX + Random(10) -5, WinY + Random(10) -5, #PB_Ignore,#PB_Ignore )
    Shaker -1
  ElseIf Shaker = 1
    ResizeWindow( 0, WinX, WinY, #PB_Ignore,#PB_Ignore )
    Shaker = 0
  EndIf
  
Until Event = #PB_Event_CloseWindow ; End of the event loop

End
;

Make your own picture... My new version of this is a floating window that is skinned!

Thanks Kaeru and Idle that showed me great ways to shake a window in a nother thread!!!

Re: Magic Emo Ball code

Posted: Thu Sep 17, 2009 7:34 am
by Teng
Emo is right, sounds like that famous Eliza chat program, except this Eliza has PMS or something :lol:, just out of curiousity what does the MEB001.jpg look like? Thanks for sharing.

Re: Magic Emo Ball code

Posted: Fri Sep 18, 2009 6:20 pm
by Rook Zimbabwe
It is a picture of a ball. I have pasted the word EMO on the front of the ball in the center... :mrgreen: