insert wade into website
marcdonegan

Hey, ive made a basic game using wade and ive made a website using notepadd++ and id just like to insert the game ive made into the website so that it all functions together and the game appears on screen 

All 7 Comments
Gio

Hi

 

There are many ways, but 2 are most common:

 

1) The easy way (recommended - that's why it's called the easy way)

Just put your wade app inside an iframe on your website

 

2) The hard way (not really, but harder than an iframe)
 

Use wade.setWindowMode('container'), wade.setContainerName(...)  (please refer to the documentation for those functions) and create a div to put your game into. This may get a bit tricky when you need scrolling functionality, depending on whether you want to catch mouse wheel and scroll events in the WADE app, in the page, or both. If in doubt, please use the easy way.

marcdonegan

sorry im really really useless, i dont have a clue what an iframe is. just looking it up know but do i just copy and paste the source code into it? what about the whole folder including images and and stuff

Gio

No worries, it's OK to ask these questions.

 

So you have created your game, and it's a bunch of files and folders. The "main" file will be index.html. If you upload the whole thing to a webserver and go to your game's index.html, the game loads and uses the full window of your browser by default.

 

Now put the whole thing inside a sub-folder of your website, call it something like "game".

 

So the "main" file of your website will be called index.html (in the root folder), and in the same folder as that file, there is your "game" folder, that also contains an index.html, which is the main file of your game.

 

Now in the root index.html (the main file of your website), add this code where you want your game to appear

<iframe src="game/index.html" width="800" height="600"></iframe>

Hopefully there should be nothing else to do and it should work.

marcdonegan

hey again, i havent uploaded it to a webserver unless you mean chrome. the website is just goingto be ran from notpepad++ on my computer and ive done what you said but it says unable to load main app script app.js  

Gio

Yes, Chrome will block the execution of local scripts by default. You have a few options:

 

  1. Upload it to a webserver ( you know so you can access it via http://www.yoursite.com )
  2. Open it in Firefox instead of Chrome
  3. Run Chrome with the command line argument --allow-file-access-from-files
  4. Download prompt.js, go to the folder of your website and type server 1234, then press Enter and type localhost:1234 and Enter again
marcdonegan

Hey again! just opened it up in firefox everythings working fine Thankyou for your help.

SupremeVampyricEvil

Thanks so much guys! I had the same issue! 

Post a reply
Add Attachment
Submit Reply
Login to Reply