Wordpress/HTML5/Construct 2

Discussion and feedback on Construct 2

Post » Fri Jun 03, 2011 4:52 am

Anyone out there willing to answer complete noob questions about if/how a Construct 2 HTML5 canvas export could or could not be used in a wordpress site, ideally one running a Twenty Ten child theme?

And - is this actually the correct area of the forum to ask questions on this topic?
B
1
G
1
Posts: 5
Reputation: 435

Post » Fri Jun 03, 2011 5:17 am

You can run it anywhere you have access to Javascript. However you also need to have access to local storage, unless you change the urls pointing to resources within the script.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri Jun 03, 2011 5:43 am

Thanks for the reply, newt. Did I mention I'm a total noob?

1. I don't know what local storage is, let alone if I have access to it. I found this info from a quick google search, but the code parts are unreadable to me because I don't know anything about Java Script at all.

Do I need to know Java to have access to local storage? Is that even the right question to ask?

2. Again, did I mention I'm a noob at everything other than setting up a wordpress site and playing a bit with the css?

3. Per #2: My understanding so far is: I would create a game and it would be exported in a file in HTML5 format. So I would have a file, yes? But then, what exactly would I do with that file? (and if the answer is "upload it" rather than paste it into the HTML editor when creating a wordpress page, I would need to know pretty much exactly where to upload it to. I do have FileZilla and can see where the wp-admin/js directory is, if that's relevant at all - is it?).

4. See #2 above, I am not kidding around about that. As I suspect is now obvious.

Apologies in advance if this is too basic to be asking here.
B
1
G
1
Posts: 5
Reputation: 435

Post » Fri Jun 03, 2011 6:15 am

Honestly, I'm a bit of a noob myself when it comes to web stuff, but here goes.

Local storage would be anything that the game uses, graphics, sounds, and the .js, that are separate files, the script you paste into your html page will use.
So if you cant upload files to the same directory that the page will be in then you will have to alter the script you paste, and the Javascript files, and resources, that you will have to upload somewhere else, to point at each other.
But, since you have ftp access, you don't have to worry about changing anything except the script you paste into the page.

As far as setting up the script you paste, take a look at the exported html.
You can pretty much copy everything in between ,<head>, and </head>, and paste that between those tags on your page, same goes for the body, except you paste the div where you want the game to show up.

Thats just from my experimentation, you will probably want to look a few things up, like how to center the div, etc.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri Jun 03, 2011 2:08 pm

Local storage is probably the wrong term to use, since it usually refers to HTML5 local storage which is something different completely. I think newt means ftp access, basically.

To make a C2 HTML5 app run on a Wordpress site you need two things:
1) ability to upload the exported files to the server (often via ftp)
2) ability to change the HTML code of the page (to insert the canvas tag).
If your Wordpress is hosted by a provider, you probably can't do either. If it's your own server running Wordpress, you probably can do both. Where's your Wordpress hosted and can you modify it?
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Fri Jun 03, 2011 8:08 pm

Hi Ashley,

Thank you for the reply!

The site is hosted by Blue Host. It's my domain through them. I don't know what you mean by provider. I just checked with Blue Host and they said I can do both of the things you specify.

I can modify the files of whatever theme I use (css and php) - though I don't know what to do with php at all, so "can" is a very loose word there.

1. Upload to server: Where specifically would I upload the exported files to? Could you give me an actual path/location? Or as close as you can get? I really truly have no clue where this would upload TO.

2. HTML code: This is where things get especially confusing to me. There is a HTML text editor on each page, along with a visual editor. I've found little snippets of HTML5 code in tutorials on the web and tried them. I can insert a canvas tag in that HTML text editor and what's in the tag seems to work (eg it gives a defined area or whatever) but anything else (filling in the area with color, putting a line in there etc) doesn't work if I just take the code and paste it into the HTML text editor.

But - do you mean something else when you say "the ability to change the HTML code of the page"? If so, what?

(the rest of the page is, as far as I know, governed by the theme's css for the style, and the theme's php files for the rest of it)
B
1
G
1
Posts: 5
Reputation: 435

Post » Fri Jun 03, 2011 10:48 pm

I was thinking about how to answer the question, but to be honest I think a much simpler thing to do is:
1) upload all the exported files to a new folder on your server (by ftp) - anywhere you like, then
2) just link to index.html in that folder.
If you know HTML you can modify index.html as much as you like to style like your blog, have instructions and help, and so on.

It is possible to integrate it in to the Wordpress blog, but there are complications. For example, you could upload one game, but uploading a second would replace the first. This is because C2 doesn't yet give you any options when you click export - it just dumps the files to a folder. This is C2's fault - we haven't added the necessary features yet.

I can go through how to integrate the game anyway if you like, but I think the link-to-a-folder will work better for now I'm afraid. I've added better export options to my todo list!
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Fri Jun 03, 2011 11:27 pm

Thank you Ashley!

So -- to make sure I understand your suggestion:

1. I would basically create a page (or more than one) outside of the Wordpress environment, then (to the extent that my HTML knowledge/learning would allow) style it to look similar and link from the wordpress site to it?

I've never done this, but it has been in the back of my mind. But -- yeah, I've never done it. So,

2. If I understand your suggestion correctly, I could pick *anywhere* on the server to upload via ftp? Like for example, in a folder just under public_html?

3. Then what I uploaded from C2 would already have an index.html in there to which I could link?

4. And I could edit that index.html file? (my HTML is spotty, as I mostly have worked with css and not much of that - but it seems easy enough to learn)

Am I getting this? Please correct me where I don't get it.

And thanks. I am all for what would work now, so your workable suggestion is really important to me. And yeah, who knows, we might want to upload more than one game at some point, for sure.

In the longer term, I do think it would be great if in the future C2 could work directly with/inside of wordpress -- feels like a lot of sites (and some web designers) are using it these days. So if you assess it to be worth the time/energy over the longer term, that would be fantastic.
B
1
G
1
Posts: 5
Reputation: 435

Post » Fri Jun 03, 2011 11:58 pm

You don't need step 1 - when you press Export in C2, one of the files it generates is called index.html. Then, you can edit that file how you like. HTML is fairly straightforward, there are tutorials on the internet. You can upload all the files C2 exported (including your edited index.html) anywhere you like - to its own folder is probably a good idea - and link to it from the blog.

If you just want to try and get something working, just upload the entire folder C2 exports to the server and you should at least have the game running!

You're right that this should be easier - you've arrived at a very early stage in C2's development though, we're still sorting these details out.
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Sat Jun 04, 2011 4:11 am

Ashley, thank you. This is great. Will also be avidly following C2's development.
B
1
G
1
Posts: 5
Reputation: 435

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests