You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

JasonS

Trainee

  • "JasonS" is male
  • "JasonS" started this thread

Posts: 65

Date of registration: Feb 17th 2010

  • Send private message

1

Tuesday, November 15th 2011, 8:14am

Present Snatch

Got bored, made a goofy little Christmas game. It's called "Present Snatch"...

It's on the main page of www.tecktronic.net

Or the page can be directly accessed via http://www.tecktronic.net/xmasgame/

Happy Holidays!
~Jason

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

2

Thursday, November 17th 2011, 12:39am

Nice.

But after closing the browser window with this game, there comes every time a NullPointerException.

Can you please trying, if it helps to add the following SUB to your Applet1 class?

Jabaco Source

1
2
3
4
5
6
Public Sub destroy()
  Timer1.Enabled = False
  Timer2.Enabled = False
  Timer3.Enabled = False
  Timer4.Enabled = False
End Sub



There existing four SUBs which are automatically called in Java Applets:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
Public Sub init()  ' Is called one time after the Applet starts
End Sub

Public Sub start()  ' Is called every time when the users goes back to to Applet window
End Sub

Public Sub stop()  ' Is every time called, when the user goes out from the applet
End Sub

Public Sub destroy()  ' Is every time called, when the user closed the browser window with the Applet
End Sub


Greatings
theuserbl

JasonS

Trainee

  • "JasonS" is male
  • "JasonS" started this thread

Posts: 65

Date of registration: Feb 17th 2010

  • Send private message

3

Thursday, November 17th 2011, 2:41am

Hi theuserbl,

I changed what sub the timers are shut off in to Sub destroy()... and guess what? It worked. **Thank you** I have been trying to figure out how to do this for, quite some time with little success. How did you figure this out? =P

To all of those as confused as me... Please note that.. Sub Applet_Destroy() and Sub Destroy() are not the same thing, obviously lol.

This was the main reason I would get exceptions in all of my other web applets too when closing them. I knew there had to be a way. And you got it! Once again, a sincere thank you for this info. :)

Sincerely,
Jason

JasonS

Trainee

  • "JasonS" is male
  • "JasonS" started this thread

Posts: 65

Date of registration: Feb 17th 2010

  • Send private message

4

Wednesday, December 7th 2011, 9:01am

About destroy() and Me.destroy

A few things to add to this subject.. since I could not find any similar threads about the subject...


To get your winsock/graphical app to close correctly.. You must use the Sub destroy() ... not Applet1_Destroy() ... Inside of that sub, you must kill all timers, animation loops, and winsock connections [using Winsock1.Close() or whatever your winsock is named...], then I have also found it helpful to add in a line at the very end of Sub Destroy()... Me.Destroy()

Now, make sure when you type in the () at the end of the line with Me.Destroy() on it, that you have Me.Destroy () <1> selected, NOT Me.Destroy() <2> .. took me awhile to figure out that version 2 of this method does not work.. even though they look identical in the intellisense.. Its weird, but it works..

Greetings,
Jason

This post has been edited 1 times, last edit by "JasonS" (Dec 8th 2011, 3:12am)


JasonS

Trainee

  • "JasonS" is male
  • "JasonS" started this thread

Posts: 65

Date of registration: Feb 17th 2010

  • Send private message

5

Friday, May 11th 2012, 4:32am

Source code

Hi,

I have made the source code to this applet available at http://www.tecktronic.net/xmasgame_sourcecode.zip

This is a basic example of how to use the .PaintPicture method and an animation loop, without the need of using any sockets or connection to a remote server.

Please compile your applet as a .jar file and place in same web server directory as index.html and xmasgame_with_facebook_posting.html . The facebook html file shows how to make 'prompts' to post things to a users wall popup, using string data from the applet itself (score, etc). This feature uses javascript, there are ways to do it with php too.

Enjoy, and please let me see anything cool that gets derived from this. :)

Regards,
Jason

JasonS

Trainee

  • "JasonS" is male
  • "JasonS" started this thread

Posts: 65

Date of registration: Feb 17th 2010

  • Send private message

6

Friday, July 13th 2012, 9:03pm

Java 7

Java 7 update broke my ability to embed wav files as resources into Jabaco applets and utilize them via web applet view mode. So now when you try to play this game, as soon as a sound plays you get exception dialog instead. I still have yet to update the code for this program and its source code to have it load the resources off of the web server at applet load, I will take care of this soon.

Regards,
Jason

JasonS

Trainee

  • "JasonS" is male
  • "JasonS" started this thread

Posts: 65

Date of registration: Feb 17th 2010

  • Send private message

7

Sunday, November 25th 2012, 9:48pm

HolidayGame II / XmasGameV2

Hello,

I have finally updated this code to work properly with JRE 7. I do not know if it will work with older versions of JRE for sure. Some things were depreciated going into JRE 7, and for whatever reason, pictures/images can, but wav files can no longer be embedded as a resource in Jabaco and be utilized the same way. To get around this, I found a different way to download the wav files off of the same web server the applet and html files for it sit, and at applet loadtime is where it loads the wav files after downloading each one, into memory, then they can be played.

I had to do the same thing with my JRPGT project, in order to get sound to continue to work, in my all my apps it seems. Also, I found that signing the JAR file before deploying it (after each recompile), cured problems of 'access denied' exceptions when trying to open a URL in the same or new tab, window, etc (at applet browser run time) using the BrowserBareBones class (which also must be included as a reference in your project, the jar file for BBB).

Facebook also changed the way you can allow things to be posted to players walls too, so I have the "High Score" popup posting not working yet still, but that in itself is what allowed this app to spread itself around facebook so easily.

Anyways, I will have a new source code zip containing the Jabaco project/source, and put together and posted soon. Inside it will contain not only the project src code, but an htdocs folder for you to place its content into your own htdocs folder on your web server, etc.. and possibly with a README file. It will include the html/php/js for using this demo the facebook way and the way it presents the same .jar file on my website directly. I also use invisible counters from statcounter.com to keep track of my hits per app.

This is no network server required for this applet/demo, except a web server.

Stay tuned for another reply to this thread with a zip file or link to one with the project source/bones :)

https://apps.facebook.com/holidayfungame/
http://www.tecktronic.net/fb/xmas/
http://www.tecktronic.net/xmasgame/

Regards,
Jason

Rate this thread
WoltLab Burning Board