Pasting data between arrays

This forum is currently in read-only mode.
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • Right I can tell this is going to make zero sense to anyone but I'll try.

    I have two arrays one is 150x150 in size and the other is 20x20. The screen size is 150,150 so the larger array represents each pixel on screen.

    I'm trying to put the data (is loaded from a saved array and is either 1 or 0 nothing complicated) from the smaller one (array2) into the larger (array1) where the left mouse button is clicked but it doesn't seem to work properly. It pastes the data but nowhere near where the mouse is clicked. I've probably mucked up maths wise but this is bugging me now. What I've tried:

    On mouseclick I set 2 global variables to the mouse X&Y when clicked.

    For Each element array2

    current index is 1 set array1 currentindex + Xvariable & currentindey + Yvariable to 1

    In my mind if the current index is 10,10 and the mouse is clicked at 50,50 it should set the data in the larger array to 1 at 60,60.

    Don't really want to post a cap as it's very messy at the moment but can anyone see what is going to be my simple mistake.

  • Not sure if it's just the pseudo code you've posted, but it doesn't look like you're checking the value at x,y, but instead just using a single currentindex.

    Other than that, check you're using the correct type of mouse coords.

    It looks like it should work otherwise.

    Krush.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah it's my pseudo code I check if the value of the small array is 1 then set the value in the larger array as 1. If the small array value is 0 I set the larger array value as 0.

    I'm going to keep trying this as I'm sure it's so simple that I can't see the problem for looking.

  • Ok I sussed it. Well sort of.

    I recreated my events but used sprites instead of colouring pixels with the Image Manipulator and it pastes my data where it should be. Well for now it seems.

    I'll probably find a way to break it again at a later date.

  • Ah, another image manipulator bug perhaps?

  • I didn't test it with the actual version, but in v96 the vertical coordinate of the image manipulator is turned upside down. 0 being the bottom of the image instead of the top. That might have caused it?

  • I didn't test it with the actual version, but in v96 the vertical coordinate of the image manipulator is turned upside down. 0 being the bottom of the image instead of the top. That might have caused it?

    That sounds like what I was experiencing.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)