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 tomsiodlak

Hi all,

I'm a designer/web designer very interested in HTML5 games so I picked up a copy of Impact. I've been reading a lot about JavaScript and jQuery but not yet at the point where I can code from scratch.

I was able to modify the demos, but creating new functionality is a little over my head. My main question is when coding new features into the engine are you limited to the Impact library or can you use other JavaScript functions too?

For example I modified one of the spikes from the jumpnrun demo to not move and be a passive npc. I duplicated the file and named it npc but now I want a dialog box to appear above the spike when a certain button is pressed. Is all this done with Impact or drawing the box above the npc with JS and Canvas?

I can see how it can be done with JS and Canvas from the tutorials I have went through but using the Impact library is not as clear to me.

1 decade ago by fugufish

a dialog box could be done in one of two ways (that I know of)
- using jQuery to create a popup
- draw a popup image using impact, and add text in there

there aren't any 'standards' to adhere to when you want to add stuff to ImpactJS. It's Javascript, and you have the freedom to get other libraries ( think LightBox, jQueryMobile, etc), do some configs and stick it in. And the good part is it works!

1 decade ago by tomsiodlak

Thank you I will look into both of those methods.

1 decade ago by tomsiodlak

I understand how to draw text with just JS and Canvas but not having much luck with it in Impact. Ideally I would want to show text above an NPC when you activate them with a key press but I am trying to start small.

I created code so when you press key 'z' it should display 'Some text'. When I press 'z' I don't see text appear anywhere on the screen.

// talk
if( ig.input.pressed('talk') ) {
		
var font = new ig.Font( 'media/04b03.font.png' );
font.draw( 'Some text', 10, 10, ig.Font.ALIGN.RIGHT );

I put this code within the update: function() { } in my player.js file. But if I wanted to later on add this to an NPC would it go in the npc.js? If I wanted to have multiple different NPCs then I assume I'd need a different file for each one.

1 decade ago by tomsiodlak

I tried to do it a different way based off the video tutorial but this didn't work either...the game won't even run:

// talk
  if( ig.input.pressed('talk') ) {		
				
  _wmDrawBox: true,
  _wmBoxColor: 'rgba( 255, 0, 0, 0.5)',
  _wmScaleable: true,
			
  message: 'You got killed!',
  font: new ig.Font( 'media/04b03.font.png' ),
			
  update: function() {},
			
  draw: function() {}
		
}

Can anyone please help?

The error:

Uncaught Unresolved (circular?) dependencies. Most likely there's a name/path mismatch for one of the listed modules:
game.main (requires: game.entities.player)

1 decade ago by Hareesun

Uncaught Unresolved (circular?) dependencies. Most likely there's a name/path mismatch for one of the listed modules:
game.main (requires: game.entities.player)

Basically means that there’s a name or path problem in your main.js relating to your player.js file. Maybe you don’t have one and it’s looking for one or maybe you’ve got one but it’s not configured correctly. Look at the samples on your download page to see how a file should be constructed and linked to.
Page 1 of 1
« first « previous next › last »