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

10 years ago by collinhover

@jtokarchuk

Character speed: characters have several different max speed properties, to allow you to control how fast they can go in different situations, and this is also the case for friction, though speed is always the same. Have you tried changing these specifically? Here are the properties: https://github.com/collinhover/impactplusplus/blob/master/lib/plusplus/abstractities/character.js#L133

Scaling: o keep the game shown at about 160x144, you should use the GAME_WIDTH_VIEW and GAME_HEIGHT_VIEW properties in the config-user file. Set them to 160 and 144 respectively, and the game will be scaled to try and keep that ratio in the view. If you need it to be exactly at that view, you'll want to set your canvas css to that ratio as well, and there is a small chance you will need a little bit of custom code in your game's resize method.

10 years ago by zazou

I have followed the impact++ installations instructions and tutorial to a tee - yet when I get to step 6 of the 'getting started' tutorial, i'm stuck with weltmeister producing this ineffectual page - am i doing something wrong ?:

http://s7.postimg.org/t6jddma5l/Screen_Shot_2014_05_04_at_12_45_48_am.png

EDIT: figured this out - didn't realize that you needed media folder to be copied over for it to work.

10 years ago by fjork

Trying to figure out how to add audio for entitities like player and projectiles, but cant seem to find a solution. Anyone have any ide?

10 years ago by pattentrick

@fjork

Add the sound that you need at the initProperties method of your entity class:

initProperties: function() {
	
	// Call parent
	
	this.parent();

	// Soundeffect

	this.explosion = new ig.Sound( 'media/sounds/explosion.*' );
	this.explosion.volume = 0.2;

}

After that you can play the the sound with the default play method of ImpactJS like this:

this.explosion.play()

10 years ago by PabloAM

Thanks for this library, is awesome!

Just a question.
How could I add a "double jump" for example. I´ve done in ImpactJS but is a bit hard to do it in ImpactJS++.

Any idea?

Thanks!

10 years ago by pattentrick

@PabloAM

Glad that you like ++. Double jumps are possible with a few modifications. In ++ the player inherits from the character abstract. The character abstract
handles movement, climbing, jumping and so on. So let's override some methods of that class. First, open your player class and add these two new properties:

canDoubleJump: true,

jumpCounter: 0

After that we need to override some stuff as mentioned before. So add this two methods to your player class:

jump: function() {

	if (this.canJump) {

		if (this.climbing) {

			this._jumpWhileClimbing = true;
			this.climbEnd();

		}

		if( this.jumpCounter === 2 ){

			this.jumpCounter = 0;
			this.canDoubleJump = false;

		}

		if ( this.canDoubleJump || (this.grounded || (this.canClimb && this.withinClimbables) || this.ungroundedFor < this.ungroundedForThreshold) && this.jumping !== true) {

			this.jumping = this._jumpPushing = true;
			this.jumpStepsRemaining = this.jumpSteps;

			this.jumpCounter++;

		}

	}

},

jumpEnd: function() {

	this.jumping = this._jumpPushing = false;
	this.jumpStepsRemaining = 0;

	if (this._jumpWhileClimbing) {

		this._jumpWhileClimbing = false;

		this.climb();

	}

	this.canDoubleJump = true;

}

That should do the trick. I tried it with the SUPERCOLLIDER demo and it worked fine. Please let me know if that works for you. I think it would be a great idea to have an option for enabling multiple jumps by default in ++. I may talk with @collinhover later on about that, and add this behavior (less hacked, cleaner code) to the character abstract.

10 years ago by fjork

@pattentrick Thank you! Not sure if im a slow learner but cant figure out how to implement it. Maybe you or someone else can show me a full example from an entity from SuperCollider? :)

Have another question, I want my game to be a 2 player co-op game. Been checking out nodejs and socketio but it seems hard to get that to work with impact++. But how hard is it to implement a second player that uses the same keyboard? Any help would be appreciated.

10 years ago by pattentrick

@fjork

Regarding to the sound example:

ig.module(
    'game.entities.bee'
)
.requires(
    'plusplus.abstractities.character',
    'plusplus.core.config'
)
.defines(function () {

    var _c  = ig.CONFIG;

    /**
     * A buzzing bee that flies over the meadow.
     *
     * @class
     * @extends ig.Character
     * @memeberof ig
     */
    ig.EntityBee = ig.global.EntityBee = ig.Character.extend({

        size: {
            x: 10,
            y: 6
        },

        animSheet: new ig.AnimationSheet( _c.PATH_TO_MEDIA + 'bee.gif', 10, 6 ),

        animSettings: {
            idle: {
                frameTime: 0.1,
                sequence: [0,1]
            }
        },
		
		initProperties: function() {
    
			// Call parent
			
			this.parent();

			// Add the soundeffect

			this.buzz = new ig.Sound( 'media/sounds/buzz.*' );
			
			// Change the volume
			
			this.buzz.volume = 0.2;
	
		}

        updateChanges: function(){
		
			// Call parent
		
			this.parent();
			
			// If something happens in your game, play the buzz sound.
			
			if( somethingIsTrue ){
			
				this.buzz.play();
			
			}

        }

    });

});

Impact++ does not alter the way ImpactJS handles sound, so if you have any problems with the sound class, take a look at the docs here:

http://impactjs.com/documentation/class-reference/sound

Could it be that you just provided one sound file? You need every sound file as .mp3 and as .ogg for proper browser support.

Regarding to your multiplayer questions, I have to admit that I have no experience with multiplayer games. However, you could make all your players as
characters (http://collinhover.github.io/impactplusplus/ig.Character.html) and bind input as usual.

In your main.js

inputStart: function(){

	// Player 1

	ig.input.bind(ig.KEY.LEFT_ARROW, 'playerOneLeft');
	
	// Player 2
	
	ig.input.bind(ig.KEY.C, 'playerTwoLeft');

}

In your character (player two) class:

updateChanges: function(){

	// Call parent
	
	this.parent();
	
	// Handle Input
	
	if ( ig.input.state('playerTwoLeft') ) {

		this.moveToLeft();

	}
	
}

There is also the player class (http://collinhover.github.io/impactplusplus/ig.Player.html), but I am not sure how the player manager (http://collinhover.github.io/impactplusplus/ig.PlayerManager.html) works with more than one player.

As far as I know the player manager can only handle one entity at a time, but you could maybe instance more than one player manager. But as I stated before, I have no to little experience with multiplayer.

10 years ago by pattentrick

@PabloAM

We added support for “multiple jumps” to Impact++. Switch to the current dev branch, and then add this to your character:

canJumpRepeatedly: true

By default, there will be just one additional jump, which will result in a double jump. But you can define as many additional jumps as you like. This will enable a quadruple jump for example:

additionalJumps: 3

If you have any problems with this new feature, please open an issue on the GitHub project page and I will take a closer look at that.

10 years ago by itsOgden

First off wanted to thank collinhover and everyone else that has helped with Impact++. I am using it on my current project and this gave me a huge boost in getting it started and keeping things simple and running smoothly.

I'm having trouble figuring out touch handling. For a portion of my game I am using the activateComplete method of ui-buttons to record the touch event because i need to be able to tell if the entity is being touch and record the x,y position (which works great for ui-buttons).

The issue is that I need to be able to record these touches on other entities that are not part of the UI as well as register the same way whether it is tapped, or held.

I can figure out clunky and complicated ways around all this, but I know there has to be a simple solution using Impact++ and I'm just missing it.

I would really appreciate any help you guys can give me!

10 years ago by pattentrick

Hi there @itsOgden,

glad to hear that you like ++! By default all entities in ++, not just the UI elements, have an activate or deactivate method already built in. You can call those methods if you registered a tap on one of your entities and do whatever you like at that method.

To register this tap/click on your entities you could take a look at the target property of the input points. You can see a code example on how to do it here:

https://github.com/collinhover/impactplusplus/blob/dev/lib/plusplus/core/game.js#L2210

If there is an entity at that point, the target property will contain a reference to it, and you can call the activate/deactivate method of that entity.

I hope this will help you. If not, don't hesitate to post again. Also, this thread is not highly frequented. You may get a quicker response if you post an issue at the GitHub project page.

Offtopic:

I am really interested in your game. I made two small games with ++ until now:

http://impactjs.com/forums/games/super-snail-rescue-shoot-em-up
http://impactjs.com/forums/games/schreibers-quest-point-n-click-adventure

Feel free to contact me via GitHub if you want to exchange ideas on how to implement certain game mechanics in ++, or you have already some gameplay you want to show.

https://github.com/Pattentrick

10 years ago by Arturo

Hi everyone!

This is my first post around here. Ive been looking this forums for a while searching for help and solving some problems. Im new with impact, so there is still basic stuff that I dont understand, but hopefully I will be able to learn them soon :)

I got a question with impact++, so I thought that this was the place to ask.

I got two different Entities from EntityExtended: A and B.
I want to do that when A collide with B, A goes to the center of B (in a smooth way) and at the same time take the same size (A is a circle, so I want to make the circle around B).

For that, Im using moveTo() in A, and giving the position of B. But that make the move straight away, not in a smooth way. Is there a way to make it like that? like giving 2 seconds to get there or something?

If not I thought, I could get the distance, and calculate 5 positions and make 5 move, (I dont know how to use moveToSequenceNext though), and at the same time, change the size of the A entity.

Any ideas or sugestions?

Thanks, and congragulation to the people for impactjs and impact++. Amazing tools!!!!

10 years ago by RockLeo

Hi everyone,

Many thanks to you guys, It's been a lot of fun using Impact++.

I have a lot of hope that I can finish a basic game with this library.

I'm really newbie using Impact, but I really am pregressing with ++

Thx again

10 years ago by RockLeo

Hi everyone,

Can anyone teach me how to put custom anim to shoot, punch, whatever I need?

I searched everywhere and found some codes, but still didnt realize what I need to do.

I used the post where Collin tells about "updateCurrentAnim" and how to place a "prone" anim. I managed to place custom animation to move, jump, climb, fall, idle, grounded. But those have a boolean like (this.jumping or this.climbing, and I have no idea how they work). If I create a var to hold the input, the animation dont stop until I hit another button.

Thx everyone!

10 years ago by pattentrick

Hi there RockLeo,

a really quick solution would be to use the animOverride method:

this.animOverride('punch', {
    lock: false
});

You can take a closer look at the method and it's properties here:

https://github.com/collinhover/impactplusplus/blob/master/lib/plusplus/core/entity.js#L2495

But you could also change the list of the expected animations for your character:

https://github.com/collinhover/impactplusplus/blob/master/lib/plusplus/abstractities/character.js#L96

Or you could disable the automatic animation behavior with this and add your own code:

animAutomatic = false;

Collin explains that stuff in detail here:

https://github.com/collinhover/impactplusplus/blob/master/lib/plusplus/abstractities/character.js#L40

This thread is not very active any more. In the case that you can't fix your problems with the examples i provided, please visit the GitHub page of Impact++ and post an issue:

https://github.com/collinhover/impactplusplus/

Other ++ developers, including myself, will help you if they can.

10 years ago by jamaalsd

Hey, this is going to sound really really stupid, but all I want from impact++ for the moment is for it to maintain a 16:9 screen ratio based on the browser size with an original resolution of 640x1136, or 320x568 scaled up 2x (haven't decided yet).

I have been sitting here for a while now and for the life of me I cannot figure it out. Can someone please help me?
Page 6 of 6
« first ‹ previous next › last »