How do I change the html background

Get help using Construct 2

Post » Tue May 09, 2017 4:02 pm

Is there an easy way to change the background behind the HTML5 game in C2? I'm referring specifically to the exported index.html. I know I can edit it after the fact, I just like to know if I can do it from within C2? I'm hoping there is a plugin...
B
16
S
7
Posts: 190
Reputation: 1,823

Post » Tue May 09, 2017 5:31 pm

Nope.
Image ImageImage
B
172
S
50
G
182
Posts: 8,439
Reputation: 115,097

Post » Wed May 10, 2017 1:16 pm

If I understood correctly...

Image
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Wed May 10, 2017 5:25 pm

korbaach wrote:If I understood correctly...

Image


Thank you!

Edit 2: Tried this and it worked.

Code: Select all
var body = document.getElementsByTagName('body')[0];
body.style.backgroundImage = 'url(http://localhost/background.png)';
Last edited by Moot on Wed May 10, 2017 5:45 pm, edited 1 time in total.
B
16
S
7
Posts: 190
Reputation: 1,823

Post » Wed May 10, 2017 5:45 pm

You would be better off editing the index.html at this point.
Image ImageImage
B
172
S
50
G
182
Posts: 8,439
Reputation: 115,097

Post » Wed May 10, 2017 5:51 pm

newt wrote:You would be better off editing the index.html at this point.


I just don't want to have to remember to edit the index.html after every version I export. I'll probably forget.
B
16
S
7
Posts: 190
Reputation: 1,823

Post » Wed May 10, 2017 6:01 pm

Make a feature request I guess.
Im not sure that a runtime addition is the best method. More options like templates for the export would be better imo.
I'd like an option for three columns with a header, and footer for example.
But Construct2 isn't a html editor.....
Image ImageImage
B
172
S
50
G
182
Posts: 8,439
Reputation: 115,097

Post » Wed May 10, 2017 7:50 pm

newt wrote:Make a feature request I guess.
Im not sure that a runtime addition is the best method. More options like templates for the export would be better imo.
I'd like an option for three columns with a header, and footer for example.


If it causes problems, I can always delete the browser object/events and edit the index.html directly in the final version. Templates is a good idea. We should have total control over the entire presentation.

newt wrote:But Construct2 isn't a html editor.....


Well, it is and it isn't. That's like trying to tell me my truck doesn't go off road. It goes off road! 8-)
B
16
S
7
Posts: 190
Reputation: 1,823


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests