Targetting a created array at runtime?

Get help using Construct 2

Post » Tue Feb 26, 2013 1:20 am

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.capxYanen2013-02-26 01:21:14
B
18
S
3
G
1
Posts: 35
Reputation: 1,875

Post » Wed Feb 27, 2013 5:11 am

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.capxYanen2013-02-27 05:15:26
B
18
S
3
G
1
Posts: 35
Reputation: 1,875


Return to How do I....?

Who is online

Users browsing this forum: Draconinho, LeFuji, totoe and 13 guests