Targetting a created array at runtime?

0 favourites
  • 2 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I'm working on a turn based game that works as follows:

    1. You enter your unit commands, and the game makes a recording of the movements

    2. Your opponent enters their unit commands, and the game makes a recording of their movements

    3. Both recordings are played back at the same time, hits/unit deaths are assessed/etc

    I've figured out how to record the movement of a unit sprite that is static (ie starts on the layout at runtime). What i'm having trouble with is recording the movements of created sprites like bullets that need to be created after the layout starts.

    I think i'm not understanding how you would target a created array. Right now in my capx, the "bullets" array is the one that stores the movement of the bullets when they are fired. The trouble is, with only one "bullets" array, i can only store one bullet's position, so i need to create multiple "bullets" arrays (one each time a bullet is fired). How do i get access to these newly created arrays in the actions?

    Here's my capx: http://dl.dropbox.com/u/64045180/TBSTest.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So i've been working on this some more.

    I got it so that multiple bullet positions are stored, BUT i'm now having a problem where the recording of the bullets doesn't match the recording of the sprite (the bullets fire out of sync with the sprite's recorded positions).

    Anyone have any ideas about this?

    Here's a demo: http://dl.dropbox.com/u/64045180/TBS/index.html

    ENTER starts the recording

    CTRL fires bullets

    SPACE plays back the recording

    Meanwhile, here's the updated CAPX: http://dl.dropbox.com/u/64045180/TBSTest2.capx

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