Pick instance with UID Problems

Get help using Construct 2

Post » Tue Oct 02, 2012 2:43 pm

I'm using pick instance with UID and on IE9 it works perfect, with Chrome and Firefox just sometimes. Is there a limit on how many instances used, the UID is in the 1300 range.

rfisher2012-10-02 14:54:43
B
17
S
9
G
7
Posts: 249
Reputation: 6,922

Post » Tue Oct 02, 2012 3:19 pm

I changed the code to:



It works with IE9 and very slow with Firefox and Chrome. At least it works, but why so slow?
B
17
S
9
G
7
Posts: 249
Reputation: 6,922

Post » Tue Oct 02, 2012 3:33 pm

I would guess its because for each is a loop running every tick.
Image ImageImage
B
165
S
49
G
147
Posts: 8,039
Reputation: 96,570

Post » Tue Oct 02, 2012 3:35 pm

...and if the UID is around 1300, that could mean about a 1000 iterations each tick and that will probably bring down the fastest machine...
B
44
S
21
G
13
Posts: 723
Reputation: 14,740

Post » Tue Oct 02, 2012 3:47 pm

@Weishaupt

@newt

But why then does IE9 works with no delay regardless of the Machine?

I changed to a for each because there is only 30 instances of that object which is much better then 1300+ using the other method.

Also i forgot to mention that the fps never drops below 58 with both codes.rfisher2012-10-02 15:52:22
B
17
S
9
G
7
Posts: 249
Reputation: 6,922

Post » Tue Oct 02, 2012 3:57 pm

Ie9 is really fast with javascript.
Image ImageImage
B
165
S
49
G
147
Posts: 8,039
Reputation: 96,570

Post » Tue Oct 02, 2012 4:03 pm

@newt I'm getting 70-90 fps with chrome.

Here is a demo

The code i'm concerned about controls the movement of the gold coin when it is overlapped by the player. The 2 numbers in the lower right corner are the fps and global inventory variable.

Also the old code is still in place for the sword and and shield.rfisher2012-10-02 23:40:04
B
17
S
9
G
7
Posts: 249
Reputation: 6,922

Post » Tue Oct 02, 2012 4:22 pm

Am I missing something? Nothing happens, when the player runs over a coin...
Weishaupt2012-10-02 17:59:10
B
44
S
21
G
13
Posts: 723
Reputation: 14,740

Post » Tue Oct 02, 2012 5:35 pm

@Weishaupt

Thats my problem. When i run it on IE9 the coin moves to the lower left corner and the amount increments by 1. On Chrome and Firefox sometimes works.

What browser did you try it on?

rfisher2012-10-02 17:35:29
B
17
S
9
G
7
Posts: 249
Reputation: 6,922

Post » Tue Oct 02, 2012 5:57 pm

Chrome.....maybe you can share your CAPX? That makes it alot easier for us to help you


Have you tried "on colission" instead of overlapping?Weishaupt2012-10-02 17:59:23
B
44
S
21
G
13
Posts: 723
Reputation: 14,740

Next

Return to How do I....?

Who is online

Users browsing this forum: dzert14, ijust8, imhotep22, tetuan and 1 guest