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 ?
7 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?
No I didn't use friction property and using velocity did not work
this.pos.y = this.pos.y + 5;
is there any thing wrong with this code?
7 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.
7 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.
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();
}
I don't know how to see FPS I will try to find it
this.pos.y += this.vel.y * ig.system.tick + 3;
this code for the spawning entity
I can see the fps
27 entities 60 fps
I think it is not a performance issue
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
7 years ago
by Joncom
Glad you got it working :)
and if this doesn't work, what to do in such case ?
Page 1 of 1
« first
« previous
next ›
last »