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

6 years ago by ola_soubra

Hello
it is my second game with impactjs and I have a problem
the entities falling from the top (using "ig.game.spawnEntity" slow down during time . how can I let them fall with a fixed velocity ?

6 years ago by Joncom

If you set an entity velocity

entity.vel.y = 100;

it should remain constant until you change it again.

Unless, maybe you have set the friction property?

6 years ago by ola_soubra

No I didn't use friction property and using velocity did not work

6 years ago by ola_soubra

this.pos.y = this.pos.y + 5;

is there any thing wrong with this code?

6 years ago by ansimuz

Maybe its a performance issue. How many instance are you spawning ?

What is the entity doing maybe its doing a lot in the update function.

6 years ago by Joncom

Quote from ansimuz
Maybe its a performance issue.

@ola_soubra, if you require the "impact.debug.debug" module, you should be able to see what FPS (frames per second) the game is running at. If the game is running at a low FPS, it may look like everything is slowing down.

6 years ago by ola_soubra

Every 0.75 second an entity is spawn ( 7 entities ) in a screen with height 600


this.flow1 = new ig.Timer(0.75)
this.flow = [EntityBluesnow , EntityGreensnow , EntityBlacksnow ]

update: function(){

this.parent();
this.reset();

this.smile = this.flow.random();
var x = [10,176,340].random() ;



if(this.flow1.delta()>0){
ig.game.spawnEntity(this.smile,x,-500);
this.flow1.reset();
}

6 years ago by ola_soubra

I don't know how to see FPS I will try to find it

6 years ago by ola_soubra

this.pos.y += this.vel.y * ig.system.tick + 3;

this code for the spawning entity

6 years ago by ola_soubra

I can see the fps

27 entities 60 fps

I think it is not a performance issue

6 years ago by ola_soubra

Oh the number of entities increase with time you're right

I killed all entities after leaving screen AND THE PROBLEM IS SOLVED

THANK YOU JONCOM AND ANSIMUZ

6 years ago by Joncom

Glad you got it working :)

6 years ago by vickidcasey

and if this doesn't work, what to do in such case ?
Page 1 of 1
« first « previous next › last »