05
Feb 11

Making Rotatable IsoGroup

In this article, I will show you how to make a rotatable IsoGroup in As3Isolib. Well, I don’t actually rotate the group but instead, I reposition the group’s children so that the group appears to be rotated. :-)

If you’re new to As3Isolib, you can learn a bit about the basics here. If you know the library already, you might want to skip step 1.

Basic steps:

  • Subclass the IsoGroup
  • Map the group’s children’s positions to a 2d array
  • Add rotation logic
  • Rotate the array
  • Use the array to reposition the children
  • Ren­der

What I need:

  1. as3ds Array2 class
  2. an algorithm to rotate a 2d rectangular array. Just google it. It’s ever­ywhere :-)

Con­tinue reading →


23
Jan 11

SpriteSheet class for AS3Isolib

One of the requirements of my latest as3isolib project was to have “realis­tic” looks for all objects. The only way to achieve this is use bitmap assets so I paid a friend who’s really good at making animated 3d models to create animated assets for me and ren­der them as PNG sprite sheets. Another thing I had to do was blit the sheets but there’s no built-in bitmap blit­ter class in as3isolib that I could use so I wrote the SpriteSheet class below.

Next, I’ll explain how to create your sheets.

Con­tinue reading →


24
May 10

Creating Drag-and-Drop for AS3 Isolib

Some folks had asked about drag-and-drop mechanism in as3isolib discus­sion group. While there’s no such feature built-in in the library, it’s not hard to write it yourself.

So here’s a super sim­ple class that provides that mechanism, called DragManager. I bor­rowed the idea from Flex’s DragManager. Note that this class is really a sim­ple one and it doesn’t res­pect “grid” so you’ll have to modify it if you want to use it in a grid-based isometric space. Trust me, it’s not too hard ;-)

Click to see the demo

Con­tinue reading →


02
Jun 09

Auto-scroll Text Area

Ber­ikut ini con­toh kode untuk mem­buat scroll­bar kom­ponen fl.controls.TextArea otomatis ber­gerak ke bawah kalo ada penam­bahan teks sehingga baris-baris ter­baru selalu kelihatan.

autoscroll

Con­tinue reading →


06
May 09

Factory Pattern

Factory Pat­tern adalah pat­tern yang digunakan untuk memisahkan (decouple) proses pembuatan/instansiasi sebuah objek (produk) dari objek lain (klien) yang meng­gunakan­nya. Tujuan­nya supaya per­ubahan pada product class nggak menyebabkan kita harus meng­ubah kode pada client. Paling nggak akibat dari per­ubahan itu bisa diminimalisir. Dan juga supaya si factory bisa digunakan oleh banyak class.

Factory adalah objek yang ber­fungsi mem­buat objek lain (produk). Class ini menyem­bunyikan proses pem­buatan produk dari klien sehingga klien nggak perlu tahu proses pem­buatan­nya, bahkan klien juga nggak perlu tahu nama class dari produk yang dia minta.

Mung­kin kita sering menulis fun­ction seperti ini:

Cukup bagus untuk proyek kecil. Tapi coba bayangin kalo kita punya 20 class yang harus bisa bikin kopi dan semuanya harus bisa ditukar-tukar saat run-time plus si produk kemung­kinan besar bakal ber­ubah. Repot. Di sini gunanya Factory Pattern.

Con­tinue reading →