Sign in to follow this  
  • entries
  • comments
  • views

Update: Buildings and Perspective Distortion

Sign in to follow this  


Parallax Sprite with transparency and perspective distortion

I had a little free time so I threw this together. The image is a .gif, randomly rotated and repeated a random number of times from 0 to 50. As the layers build, they are enlarged very slightly to provide the illusion of perspective distortion.

Right now between the rotation and the distance offsets there is a lot of moire happening along the edges of the "buildings", but judicious use of blocks of color, and perhaps restriction rotation to 45-degree increments will solve the problem. I also had to add a single transparent pixel all the way around the image when I created it, in order to keep a hair-line from "wrapping" to the opposite side of the image. After all, I am using a fill to create the image, rather than duplicating the image directly. I feel this gives me a lot more control over how it is displayed, and allows for flood-filling large shapes with textures in order to make e.g. a long wall out of a single small brick texture and a lot of large, dynamically created sprite graphics.

Now that I am beginning to load images in a runtime, I have to correct for a security issue when accessing "the network" locally. Flash doesn't want to let the user do that, so when I compile the movie I need to use the "-use-network=false" flag in the mxmlc.exe compiler.

A little more each day. I don't have large chunks of time to spend learning these things, so I need to make the most of, say, half an hour before work, and an hour at night during the week. Such is the life of the obsessive hobbyist.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now