Drawing mupltiple images by single actor [SOLVED]

Sunflower

  • Posts: 591
Hello,
I was wondering if there's any way for single actor to draw multiple images, not only the current frame of animation, but also something else.
Why I ask? I want to make walls connecting system, which would connect parts belonging to the same block in nice way, like on this image: [LINK].
The system I was using so far (in other game creation program) works like that: for each "big" square there are 4 smaller, one for each corner. I had there function which allowed me to draw whatever I like wherever I like, so all I needed was to keep information about which image (of 13 total) was to be drawn in certain corner. However, I haven't found such function here, and I would like to avoid creating more actors for each corner, because it means 5x more objects - not the best thing when you need to optimize.

So, anybody knows how to draw images in any given place without constructing additional actors? All I need is such function or piece of code. Help will be greatly appreciated. :)

« Last Edit: July 07, 2011, 12:57:59 pm by Alexin »

Alexin

  • *
  • Posts: 3130
There isn't a way to load external images yet.

I usually create a dummy actor to "import" any image I want. Then, I instantiate it and put it somewhere offscreen and make it always simulate. Now, it's possible to retrieve the images whenever I want.

Check this out too: http://www.stencyl.com/help/viewArticle/50
"Find the fun"
alexin@stencyl.com

Sunflower

  • Posts: 591
Uh, oh...
Loading external images? O.o
No, it's not what I want to do. Unless you mean by that loading animations belonging to other actor... oh, no, actually, I didn't want to do it either.

The source of the image is irrelevant to me, I can place all of them in different animations for block actor, or even put all of them in single animation and draw only single image.
The point is: can single actor draw multiple images during one frame? Specifically in this case, can it be so that one single actor draws four separate corners. In attached image I showed how it is supposed to work: blocks (black frames) are drawing four corners each (blue frames) without making any other actors.

Geez, I hope it's more understandable what I mean now. I just want to avoid making actors whose purpose would be only to draw these corners, because they would probably cause slowdown, and draw all corners with single actor instead. ^^' I know that each actor draws their animation (unless it's said otherwise), but I hope that there's something which would let them draw also something else.

But yes, thanks for showing this layers code. I think it'll turn out useful anyway. O.o

---Edit---

Silly me, apparently the function I've been searching for was right around me. I mean, "draw image for [Actor here]" block. So all I would need would be to do something like that:
move pen to (x, y)
set animation frame to [left-up frame here]
draw animation for self
move pen by (16, 0)
set animation frame to [right-up frame here]
... and so on.
I'm going to try this solution, I'll mark this topic as solved as soon as I get this to work.

---Edit2---
Yay, I got this to work... while someone else marked this is solved. O.o
But yes, the problem is solved. ;)

« Last Edit: July 08, 2011, 03:11:26 am by Sunflower »