Inserting value in 2D array

Bugs will be moved here once resolved.

Post » Tue Mar 21, 2017 6:31 am

Problem Description

I tried to insert a new value "SUPER" in a 2D array on X and a value "100" on its Y .
In the array, it duplicates "SUPER" (even if I add a value on Y axis)

I might have done something wrong, since I'm not familiar with Arrays.


Attach a Capx
____ sorry can't upload it ____

Description of Capx
Really basic. I have a 2D array and tried to insert a value in XY.

When touched [Sprite]
ArrayName >> insert "SUPER" at index ArrayName.At(index) on X axis
Example:
arrUnits >> insert "SUPER" at index arrUnits.At(arrUnits.IndexOf("unit5")) on X axis

Steps to Reproduce Bug
  • Create a 2D array (XY) width 6, height 2, depth 1
  • On start of the layout, fill the array X & Y (with the value you desire. I used "unit0" to "unit6" on X and some values 1-100 for Y)
  • Add a touch event on Sprite
  • On touched Sprite, Insert "SUPER" on X and insert "100" on Y

Observed Result
____ What happens? ____
Notice that "SUPER" is written 2 times in the array (through the debugger)

Expected Result
____ What do you expect to happen? ____
Having "SUPER" written once, and 100 following SUPER
like:
index0: unit0,5
index1: unit1,3
index2: unit2,4
index3: SUPER,100
index4: unit3,2


Affected Browsers
  • Chrome: (YES/NO) YES
  • FireFox: (YES/NO)
  • Internet Explorer: (YES/NO)

Operating System and Service Pack
____ Your operating system and service pack ____
Windows X Familly - Intel(R) Core (TM) i7-4770 CPU @ 3.4 GHz
Construct 2 Version ID
____ Exact version ID of Construct 2 you're using
Release 239 also tested in r243
____
B
26
S
10
G
3
Posts: 72
Reputation: 4,008

Post » Tue Mar 21, 2017 9:48 am

No no no just no. This is how array dont work. Just no no no.

Check how array work.
B
22
S
3
Posts: 74
Reputation: 1,515

Post » Tue Mar 21, 2017 1:35 pm

I found how to fix my issue that I was doing wrong.
B
26
S
10
G
3
Posts: 72
Reputation: 4,008


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 4 guests