Global Vars vs Array System - performance difference?

Get help using Construct 2

Post » Fri Apr 03, 2015 1:07 pm

Hi folks,

I want to know if it impacts my games performance, say on mobile devices
(which i cant test atm because I am on the Free Edition)
if I use Global Variables instead of an Array to:
    Store Angle Data of up to 20 Objects all the time after manipulation
    Measure constantly distances between my 20 Objects and the Mouse Cursor position
    Manipulate Angle Data of any of the 20 objects next after next
All my data manipulation comes mainly from the mouse cursor position.
I am new - so if this question has an absolute "no why would it have an impact - makes no sense?!" answer then please excuse.
Just need to know HOW I build my project further in the right direction from the beginning as you surely understand.
Oh and - why Mouse on Mobile Device? I want to transform my mouse interactions in touch interactions later...

Cheers,

Solano
B
6
S
2
G
3
Posts: 9
Reputation: 2,252

Post » Fri Apr 03, 2015 4:21 pm

There shouldn't be any performance impact using one over the other. Using 20 global variables will be a pain to use so arrays are the way to go for this.

Although, it seems instance variables (each object) would be better still. Then it's only a matter of doing a FOR EACH OBJECT and reading / writing the values.
B
15
S
5
G
7
Posts: 877
Reputation: 5,650


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests