The Daily Click ::. Forums ::. Klik Coding Help ::. Active picture object resizing.
 

Post Reply  Post Oekaki 
 

Posted By Message

Aptennap



Registered
  23/04/2004
Points
  916
13th April, 2009 at 12:17:54 -

I have a tileset in an active picture object, and I want to resize the APO so that I can only see a 16x16 part of the tileset.
But when I resize the APO to 16x16 it automaticly resizes the whole tileset, how can I fix this?

 
Oh sweet mary.

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
13th April, 2009 at 14:03:15 -

Am I right to assume you trying to make some kind of tile-based game, which uses an external tileset file?

If so, this is how I go about it:

1.) Create an Overlay object, containing your Tileset image.
2.) Create a second Overlay, the size of a single tile (16x16).
3.) Use the function "Paste Overlay into Overlay", to paste an individual tile from the first Overlay into the second.
4.) Save the contents of the second Overlay as "Temp.bmp" or something.
5.) Load "Tamp.bmp" into an Active Object, using Animation -> Load Frame.
6.) Repeat for other tiles...

You can easily fastloop the whole process at the start of the frame, so it will save each tile into a different animation frame of an Active Object. You can then load them instantly, and paste them into the background etc.

This may help you to understand:
http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/SpriesetLoader.zip

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
13th April, 2009 at 14:30:32 -

If your tileset is stored externally, which I assume it is, then you don't even have to do all of that.

Load up your tileset into the active picture object with out any resizing. Then whenever you want to create a tile on screen from your tileset use the active picture's command "create backdrop object." This command will allow you to specify: the X and Y position of the created backdrop, the X and Y position of the backdrop on the tileset, and the height and width of the backdrop on the tileset.

This way you can paste the tiles quickly without having to save individual files back to the system, and keep from hammering the hard drive.

Now if you want animated tiles you will have to use the "animated picture object" I haven't used this one yet so I can't explain it.

 
n/a

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
13th April, 2009 at 23:11:11 -

I don't know about Sketchy's overlay technique (I'll look into it), but what UrbanMonk says is right.

Then, with some will, you can add rotated and flipped tiles features.
The X & Y coordinates changes though, and that's the hard part.
While your at it, why not also have foreground. Just use a second layer, and you've got a pretty complex level editor.

 
...

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
14th April, 2009 at 00:24:34 -

Yeah, UrbanMonk's idea sounds better. I just didn't know that feature ever existed.

 
n/a

Aptennap



Registered
  23/04/2004
Points
  916
14th April, 2009 at 14:50:47 -

Thanks guys, but that was not what I meant

Image
1 is my tileset.
I want the APO to only show the first (16x16) tile, like 2.
When I load the tileset with an APO that is already 16x16, the APO will change size to the size of the image.
If I do resize in the events the APO will resize the image it has inside, see 3 for that effect.

I hope this shows what I want to do

 
Oh sweet mary.

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
14th April, 2009 at 15:51:15 -

I understand your question, but:
1.) I'm not sure it's possible.
2.) I think there's going to be a better way to achieve whatever end goal you have in mind.

 
n/a

Aptennap



Registered
  23/04/2004
Points
  916
14th April, 2009 at 18:49:23 -

Oke thanks, I'll look around for an alternative.

 
Oh sweet mary.
   

Post Reply



 



Advertisement

Worth A Click