Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by UziMonkey

I just wanted to embed my ImpactJS game (a Ludum Dare entry) onto a Wordpress page. I did it, but it took most of the evening to get everything just right.

At first I used an iframe. This works just fine, except there's a focus problem and you have to click the game or it won't receive any events. If you click outside of the iframe, you have to click it again. I wanted to avoid this confusion.

So I decided to go with a prefix prepended to all paths. You just define it in window.igprefix before you load your game and you're good to go. The ImpactJS source code has to be modified in a few key places, but it's not difficult.

The specifics are here on my blog: http://www.uzimonkey.com/?p=45

Dominic said he might include this in the next version of Impact, so this hack might not be needed for much longer.

Also, to everyone who says this should be a plugin, I couldn't figure out how to get that to work. The plugin needs to be loaded by the loader code, which needs to be patched by the plugin in order to find the plugin.

1 decade ago by Graphikos

Maybe not a plugin but perhaps a tutorial entry over at http://pointofimpactjs.com. ;)

1 decade ago by gxxaxx

Nice work UziMonkey.
Good solution.

1 decade ago by jaygarcia

Looks cool. I'll be honest. From an OO perspective, modifying the source seems very dirty :(.

Is there a MyClass.override({ /* properties & methods here */}); method that you could use?

1 decade ago by UziMonkey

I don't really think cleanliness and correctness matters here. It works, it's just a stopgap until it can become an official feature.

1 decade ago by Arantor

You're generally supposed to use the bake script in the tools folder before making it public, which will change things (notably that Impact is minified and that all JS is in a single file, meaning that only external asset paths need changing)

1 decade ago by jaygarcia

I understand what you're saying @UziMonkey, however it's still considered bad practice.

I support and contribute to a very large and popular HTML5 JavaScript framework called Sencha Touch & Ext JS. What we've learned since 2006 is that encouraging bad practices early on in a framework's will lead to people doing bad things like this over and over again. :-\

That's only why I commented above.

1 decade ago by UziMonkey

Ok, I heard you. It's a plugin now. It's here on my blog:

http://www.uzimonkey.com/?p=72

I'm looking into putting it on Point of Impact right now.

1 decade ago by Graphikos

Saw that.. thanks for the contribution!

1 decade ago by hurik

Does anyone have tried it with a game which uses mouse? when i embed the game i get a strange offset in the y coordinate. It is always around 20 pixel lower than the click ...
Page 1 of 1
« first « previous next › last »