Proximity between objects, and Picking

For questions about using Classic.

Post » Mon Aug 29, 2011 3:18 pm

That works really well ROJO (and if you give the tile sprite a variable you can use that as an index for what animation to play, using the same frame hierarchy as the current one you can use that for separate tilesets. =P

Definitely gonna have this in mind if I ever do a level editor.

Anyway. This does what I want to do, but even so it's not efficient enough for actual use. I want to use this real-time on a larger level. Updating every sprite with a loop pretty much constantly will make the framerate drop like a stone.

So I tried to make it more efficient. First, a "for each" loop that runs once at the start of layout, then with a second I tried to limit the loop to only updating the 8 tiles surrounding the tile that was destroyed.

http://www.box.net/shared/v990kh0t3c6xse0y5jp1

It seemed to work alright. So I increased the resolution and filled the layout with tiles, and the framerate is still dropping. As I'm typing I realize I made some mistakes (running the loop 8 times and essentially picking all of the eight tiles each time, for instance)

I'm not there yet, but I'm getting closer! =)

Edit: I think I did it. If so, wooh!

http://www.box.net/shared/qrib8jot0ejpz5io5q5cinkBot2011-08-29 15:29:04
B
73
S
20
G
10
Posts: 524
Reputation: 9,896

Post » Tue Aug 30, 2011 6:35 am

Here InkBot, same thing, but with half the number of event (14 instead of 33), and potentially... I hope... a bit more efficient.

The function object is neat when you begin to see repetition of the same kind of code. There's a getting a use to it, but it's worth it.

also, you put strange values in the random(), I rewrite these line with the equivalent. But if you wanted a particular range value of force, like between -15 and -20, you should put :
20-random(5)
for -20 to 30 it would be :
random(50)-20

bitwise_terrain_better_better.cap
Last edited by Yann on Sun Sep 14, 2014 11:40 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Aug 30, 2011 6:23 pm

I must say this is totally Neatcake

And may come in handy in the future... Thanks, Yann.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests