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 Aristy

Hi,

I have some questions.

1. How can I create an interface layer so I can make this look better?
http://i.imgur.com/oXgeD3f.jpg Basically, I would like to put them inside a transparent box (like HTML divs) so they will look much better.

2. How can I draw an image in the interface layer? For example, I want to replace "Gold:" text with a small gold image.

3. Which should I be writing this code (good practice use), main.js or player.js or somewhere else like custom attack handler?

if ( player.canAttack() ) {
If (player.isStunned || player.isParalyzed || player.isSilenced) return false;

player.attemptAttack();
}

4. I need some kind of "cooldown" mechanism everywhere. While using potions, while sending projectiles, while monsters damage me etc.

Right now I have a cooldown mechanism like this one but it looks pretty crappy.
http://paste.laravel.com/1fWV

How can I enhance this further? Is there anything like cooldown handler built in ImpactJS, so I can't hold my "attack" key and release hundreds of projectiles?

5. Can someone explain ImpactJS licensing like explaining it to a kid? If I understood correctly:
"I can sell my product to other people, but they need to purchase a license themself."

What about putting the game into Appstores (e.g Android)? Am I allowed to do so after baking/minifying ImpactJS sources?

Also, can I sell the game if I put it on my personal domain? (e.g users may donate $2, and play the game on my website, and I can allow them to save their games on my server)

Thanks alot!

1 decade ago by lTyl

1. How can I create an interface layer so I can make this look better?
http://i.imgur.com/oXgeD3f.jpg Basically, I would like to put them inside a transparent box (like HTML divs) so they will look much better.


You can use DIV overlays. However, things like CocoonJS or Ejecta will not be able to display your GUI elements because they lack the HTML DOM. PhoneGap will be able to display your game with the DIV overlays as a native application, albeit at a performance hit.

If you want something basic to learn from, I suggest taking a look at the impact++ built-in UI elements: http://collinhover.github.io/impactplusplus/ig.html.

2. How can I draw an image in the interface layer? For example, I want to replace "Gold:" text with a small gold image.


Use ig.Image. Documentation: http://impactjs.com/documentation/class-reference/image

An example:
// Property
image:new ig.Image('media/image.png'),
// In your draw function...
draw: function(){
                this.parent();

                // Draw the image
                this.image.draw(this.pos.x, this.pos.y);
}

3. Which should I be writing this code (good practice use), main.js or player.js or somewhere else like custom attack handler?

if ( player.canAttack() ) {
If (player.isStunned || player.isParalyzed || player.isSilenced) return false;

player.attemptAttack();
}


I'd put it in it's own abstract class and replace the mention of 'player' with 'attacker' or something similar. And then have every entity use the same Attack utility class:
if (attacker.canAttack(){//Do something}

Then I can expand the attack routines, or if there is a bug, I can fix it and have the change reflect back on every entity using the routine.

4. I need some kind of "cooldown" mechanism everywhere. While using potions, while sending projectiles, while monsters damage me etc.

Right now I have a cooldown mechanism like this one but it looks pretty crappy.
http://paste.laravel.com/1fWV

How can I enhance this further? Is there anything like cooldown handler built in ImpactJS, so I can't hold my "attack" key and release hundreds of projectiles?


Why not use Impact's built-in Timer class? http://impactjs.com/documentation/class-reference/timer

5. Can someone explain ImpactJS licensing like explaining it to a kid? If I understood correctly:
'I can sell my product to other people, but they need to purchase a license themself.'


The last part is wrong. You can distribute Impact in any applications / framework as long as Impact is part of your application, and not distributed independently. (IE: You build Impact directly into your game source files) Each license is per person, not per computer. So you can have multiple installs of Impact on multiple machines, but only if you are the only one that uses it. You also can't use Impact to build your own application framework or game engine if you intend to distribute it publicly, unless you work something our with Dom and get a separate license of course. If you violate any of the terms then the license is automatically revoked and you can't sell or distribute anything you've made.

So if you're working on a team, everyone on the team will need a license to Impact if they want to be able to use Weltmeister and be able to see your modifications to core Impact files. You can however, give team members access to your game code without a license, provided Impact itself is not made available.

What about putting the game into Appstores (e.g Android)? Am I allowed to do so after baking/minifying ImpactJS sources?


Yup, but you have to make sure you game complies with the Appstore Terms.

Also, can I sell the game if I put it on my personal domain? (e.g users may donate $2, and play the game on my website, and I can allow them to save their games on my server)


Yup.

1 decade ago by Joncom

Simply adding a border to your font can improve contrast and give a more polished look with minimal effort. This plugin can help with that.

1 decade ago by Aristy

If you want something basic to learn from, I suggest taking a look at the impact++ built-in UI elements: http://collinhover.github.io/impactplusplus/ig.html.


May I ask, what is Impact++? Is it something official? Can I rely on it?

Why not use Impact's built-in Timer class? http://impactjs.com/documentation/class-reference/timer


The problem is I don't know what is a good approach to handle it. Right now I coded it like that but that would require so many variables to save cooldowns, for example: projectileCooldown, monsterAttackCooldown etc.

It's something I don't get with Javascript. Basically, what I would like to do it, "give projectiles 30ms cooldown timer." Instead of checking timer with if blocks, can I just do something like:

## addCooldown(this, 30); //this -> projectile entity

using things like setTimeOut/setInterval?

I may be wrong, I just want to learn the most efficient way to handle it.

The last part is wrong. You can distribute Impact in any applications / framework as long as Impact is part of your application, and not distributed independently. (IE: You build Impact directly into your game source files) Each license is per person, not per computer. So you can have multiple installs of Impact on multiple machines, but only if you are the only one that uses it. You also can't use Impact to build your own application framework or game engine if you intend to distribute it publicly, unless you work something our with Dom and get a separate license of course. If you violate any of the terms then the license is automatically revoked and you can't sell or distribute anything you've made.

So if you're working on a team, everyone on the team will need a license to Impact if they want to be able to use Weltmeister and be able to see your modifications to core Impact files. You can however, give team members access to your game code without a license, provided Impact itself is not made available.


Excuse me, but I didn't understand. If I have a coworker, he can't use Weltmeister unless he has a license for himself, but I can give him the source codes without giving anything related to ImpactJS.

What if I sell the product to someone else? If ImpactJS is not compiled, he needs an ImpactJS license, but if the ImpactJS is compiled, there is no problem in selling it?

Yup, but you have to make sure you game complies with the Appstore Terms.


I'll read the Appstore terms, but in short, how can I compile the game when I upload it to my public domain? Is there a compress/uglify/minify guide set by ImpactJS or can I use my own tools such as GruntJS?

Simply adding a border to your font can improve contrast and give a more polished look with minimal effort. This plugin can help with that.


Great plugin! I'll start using it right away. That's what I needed.

Where can I find plugins like this one? Is there a website like plugin market or something for ImpactJS?

1 decade ago by Aristy

One more thing, my personal website is hosted on Github Pages. Can I publish my game there once I compile ImpactJS sources? The only downside would be people forking my repository and gain access to compiled ImpactJS sources, but they can already steal the ImpactJS's compiled sources by using their browser.

Is there any restrictions on this use?

1 decade ago by lTyl

May I ask, what is Impact++? Is it something official? Can I rely on it?

It's not official, but it is something you can rely on. It's a solid project done by Collin Hover independent from ImpactJS

What if I sell the product to someone else? If ImpactJS is not compiled, he needs an ImpactJS license, but if the ImpactJS is compiled, there is no problem in selling it?


Pretty much this.

I'll read the Appstore terms, but in short, how can I compile the game when I upload it to my public domain? Is there a compress/uglify/minify guide set by ImpactJS or can I use my own tools such as GruntJS?


Impact comes with its own Bake/minify tools in the "tools" folder. But there is nothing wrong with using your own tools (The license doesn't say it has to the Impact bake tools)

Where can I find plugins like this one? Is there a website like plugin market or something for ImpactJS?


Point of Impact: http://www.pointofimpactjs.com/
or the Code section: http://impactjs.com/forums/code

One more thing, my personal website is hosted on Github Pages. Can I publish my game there once I compile ImpactJS sources? The only downside would be people forking my repository and gain access to compiled ImpactJS sources, but they can already steal the ImpactJS's compiled sources by using their browser.


Have one minimifed version that contains the Impact library and one unminified version that contains your game source. People can fork your repo as much as they want, they won't have the unminifed individual impact files.

1 decade ago by Aristy

@lTyl; Understood. Thank you!
Page 1 of 1
« first « previous next › last »