Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 12:53 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: HTML5 Bejeweled game sample
PostPosted: August 28th, 2017, 3:18 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi,

I am still having some difficulty figuring out how to use an external JS file. I viewed Mack's YouTube and think that I am calling the external files correctly:

Code:
<script src="phaser.js"></script>
<script src="game.js"></script>


However, still not getting a basic example to run. Must be doing something else wrong.

The original source is a bejeweled game which has a downloadable for the complete package: http://www.emanueleferonato.com/wp-cont ... rotate.zip

A walk-through of the source code is at: http://www.emanueleferonato.com/2016/11 ... bejeweled/

This zip package contains the 2 JS files (phaser.js and game.js--see code above), a few image assets (which I tried adding to the Opus HTML5 pub, and modified the game.js paths to these images to match the Opus export's path/location).

When I publish and run, no joy.

I have attached the IMP below.

Would appreciate any help getting this sample bejeweled game to run in Opus HTML5.

Much thanks.

Kind Regards,


You do not have the required permissions to view the files attached to this post.

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: HTML5 Bejeweled game sample
PostPosted: August 29th, 2017, 4:51 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
The code is fine. That's just not a basic example. In fact, it rather advanced. It's trying to modify the DOM when the script loads and this conflicts with what Opus is attempting to do.

You can delay the scripts slightly, by using the defer option in the Script Tag, but this doesn't go anyway near far enough to get that canvas game onto an Opus page.

Personally, you probably want to find out how the scripts are automatically building the game and switch to a manual method than can be triggered once the Opus code is fully up and running and work from there.

BTW, your publication is set to SCORM publish. Is there a reason for that?

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: HTML5 Bejeweled game sample
PostPosted: August 29th, 2017, 5:08 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack,

Apologies, thought this was a "cut and paste" for the JS. Can see why it loads very slowly: the phaser.js has an enormous number of lines of code.

Need a simple match 3 game visual memory exercise (like Bejeweled) for an eLearning lesson (thus the SCORM publishing). Maybe one based on a much smaller JS library or engine.

I found a more basic version of a match 3 game here: http://www.emanueleferonato.com/2014/05 ... -controls/

source code and assets: http://www.emanueleferonato.com/wp-cont ... eweled.zip .

Loads easier, but so far not sure how to get it to center on the page and still working OK? The css in bejeweled.js is placing it at the upper left side.

So, need to change the code to center it plus keep it working OK (still able to select and move the correct objects to play game). So far, no success moving it and keeping it working OK. Maybe putting it into a container, then centering the container, even being able to rotate the container after each attempt to solve? Not sure how to do this in JQuery, so a challenge.

Attached the IMP below.

Best Wishes,


You do not have the required permissions to view the files attached to this post.

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: HTML5 Bejeweled game sample
PostPosted: August 30th, 2017, 11:59 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Not sure it's simpler :-) but Opus' is happier.

Changed code to load game into an Opus DOM element rather than body. Add calculations to work out offset of publication (not page) and Frame used to hold the game. Switch game load to manual.

Seems fine

Can be downloaded from our site: http://www.live.interaktiv.co.uk/?section=files

using code: bejewelled@digitalgrapevine.info

Can also be played online: http://sandbox.interaktiv.co.uk/bejewelled/


</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: HTML5 Bejeweled game sample
PostPosted: August 30th, 2017, 1:20 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Thanks, Mack.

Found a glitch. Sometimes, unpredictably, when quickly mousing over the tiles after game starts, after a few matches, searching for a new match-3, a tile will unexpectedly fly up and out of the frame and "disappear" and the board stops working.

It seems to be this line of code:

Code:
$("#gamefield").swipe({

When I change this to:

Code:
$("#F1D").swipe({

works OK.

Best Wishes,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: HTML5 Bejeweled game sample
PostPosted: September 12th, 2017, 4:13 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack,

Update: tested by uploading and using an Android tablet to view: unfortunately, won't pick or select gems. Tried with "Wants Touch Input" with no success. Tried with mobile FF, then mobile Chrome, no success. Also tested using Android tablet using your Interaktiv sandbox version: again no success, won't pick or select gems. I suspect jquery.touchSwipe plug-in may not play well with mobile browsers.

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 37 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group