ActionScript 2.0 :: Using CopyPixels On A Isometric Map?
Aug 4, 2009
How would I go about using CopyPixels to build an isometric map? CopyPixels takes a specific rectangle and copies that onto a bitmap.. But how would one use that to build a seamless isometric map?Building a square top-down tiled map would be very simple as copypixels pastes each tile next to one another.. But for Isometric Maps, this would be different as some parts of the CopyPixels rectangle is over lapped into other tiles.. and this would 'erase' the bitmap of the other tiles currently on the bitmap..[URL]Fig2, is what happens when you try to do a copyPixel over an existing bitmap, assuming the white is transparent space.
View 0 Replies
Similar Posts:
Jun 11, 2011
I'm trying to dynamically draw out an isometric grid but I'm hitting a few problems, currently I'm using a matrix transformation to get the grid to look more isometric that tile based but it has it's problems so I want to add the grid with out using the matrix transformations. currently I have..
[Code]....
I tried to draw it out using Sin ,Cos and Tan functions to try to set the coordinates but it didn't behave like I had expected,
View 9 Replies
Sep 26, 2009
I did a function for blit scrolling successfully using Draw(), but then I heard that copyPixels is faster. Unfortunately, I'm not having the same success with that as I had with draw();
Specifically, no matter what I try to use for the source image, it keeps saying that it can't be coerced into a bitmapData object:
Code:
TypeError: Error #1034: Type Coercion failed: cannot convert SourceBitmap_bm$ to flash.display.BitmapData.
I tried referencing the bitmap in my Library (That's how I'd prefer to do it, copy from an item already sitting in my library) that has base class "flash.display.BitmapData", yet I get the error. I tried putting the bitmap into a movieclip and copying from that, same error. I tried copying from an offscreen instance of the mc (which worked fine with draw()), same error.
It's a mess by now because i've tried so many things, but this is my code:
[Code]...
I see are for copying pixels after loading in an external file. Does anyone know of an example that works with items already in library?
View 2 Replies
Sep 5, 2010
I need to load a very big image on AS3 (currently sized at 8192x8192). I am aware that it does not fit any of the limits imposed by Flash regarding drawing to screen or creating a BitmapData of that size. I just want to load the image so I can copyPixels() some parts of it here and there.The thing is, I'm loading the .jpg file of that size with no problems. The size is recognized correctly from my Loader object. I load it like this:[code]But I am greeted with the #2015 "Invalid BitmapData" error usually reserved for BitmapDatas that are too big. The error also happens if I try to do a copyPixels(), which is what I need to do.Is there any workaround I can use so I can get data from an image this big on AS3?
View 1 Replies
Nov 12, 2010
Traditionally, when blitting in old 2d games, flips and 90 degree rotations could be achieved with almost no performance hit. The reason for this is that the effect an be achieved by simply changing the order that pixels are copied.
I'm using copyPixels in Flash to get maximum performance. Is there any way to do a flip or 90 degree rotation using copyPixels? (Without pre-calculating and storing the flip/rotate). I couldn't find a way to do it, but it seems like it should be possible, because it is a very common technique in 2d games (well, not so much now that modern 2d games use 3d hardware acceleration... but Flash doesn't let us do that, so we need to use the traditional 2d techniques)
View 2 Replies
Mar 1, 2012
I am making a custom renderer using the copyPixels function for my Haxe/Flash game. So I have this kind of code :
buffer.bitmapData.copyPixels(m_CurrentSkin, RECT3, POINT, null, null,true);
where :
-buffer is the bitmap where all my scene's objects are drawn
-m_CurrentSkinis the BitmapData that contains the current frame of the object to be drawn
Every time m_CurrentSkin contains a BitmapData that have never been drawn (the first time that an animation frame is drawn for example),I have a memory leak that is not garbage. However if m_CurrentSkin contains a BitmapData that have already been drawn (when the animation is played a second time for example), there isn't any memory leak.If I comment this line there is no leak so the problem comes from there.It seems that a copy of the BitmapData is cached in memory but I have checked in my code and there is no cacheAsBitmap explicitely set to true.
View 3 Replies
Jan 19, 2009
Can anyone tell me if I can copyPixels with an irregular shape instead of just a rectangle?
View 0 Replies
Oct 1, 2009
I am playing around with an old Zelda: Link's Awakening tile set, and was trying to make an application that will display the current selected tile.
I am well versed in as2 but have never had need for the bitmap classes until now. I have found examples of the copyPixel() function that work but could not get it to work in my code.
I have attached the .fla file I saved it as a CS2 (Flash 8) file. (I use CS3 and/or CS4 depending on which computer that I am currently using. This one is in CS3)
ActionScript Code:
// -----
// ----- Author: Nathan Sepulveda
// ----- Date: Oct 1, 2009
[Code]....
View 6 Replies
May 8, 2011
I have a bitmap which has several frames (packed along the horizontal axis). In order to render them I copy it to the backbuffer as follows:
ActionScript Code:
public override function copyToBackBuffer(db:BitmapData):void
{
[code]........
View 0 Replies
Jun 14, 2009
I'm working on my second flash game and have been stopped in my tracks trying to cache MovieClip Animations into arrays of BitmapData frames. To capture the frames I have set up a loop which runs through the frames in the MovieClip and use copyPixels to get a snapshot of the graphic.This works fine if the MovieClip to cache does not contain any child MovieClips, but if it does, these MovieClips are frozen on their first frames. I've been looking at MovieClip.getChildAt(index) in attempt to navigate their time lines but because that returns a DisplayObject it seems impossible.
So, my question is: Is it possible it to use copyPixes on a MovieClip and also step through child time lines, or should I be using sprite sheets?
View 2 Replies
Aug 4, 2011
I'm not much of a scripter. I get by editing scripts similar to my needs. I learned a few things about blitting and I'm trying to get a rectangle area of a MovieClip to blit to a location on the stage. But I run into the error "Invalid BitmapData" which makes sense because I'm referencing a MovieClip and not an image. Is there a different AS3 command other then copyPixels that would work for a MC?
I know VCam would seem an obvious solution, however VCam scales to fill the entire stage. I only want to fill a small rectangle on the stage. I've already attempted to edit VCam with no success. Its probably not the same principle, but would it be possible to blit the matrix VCam uses?
View 2 Replies
Dec 3, 2009
Is it possible to use copyPixels to capture part of the stage directly into a bitmapData object?
Just wondering because in my situation using captureBitmapData.draw(stage, matrix); is causing performance problems, even without the matrix. I read that copyPixels is fast so I was wondering if there's a trick to use that directly on the stage without the draw part.
What I'm essentially doing is screen capturing a part of the stage and putting it in a a window, using a loop to update it over time since it contains animation. Works great in one of my FLAs, but chugs in the other so looking to optimize the code to a bare minimum.
View 1 Replies
Mar 17, 2011
I have a BitmapData object with transparency (the sourceBitmapData parameter). Every time I use copyPixels() to copy it onto another BitmapData object the transparent pixels replace whatever is beneath them. I would like the copyPixels() function to simply ignore these fully transparent pixels (0x00) and NOT copy themBTW, I've tried setting the alphaMerge to true but that doesn't solve the issue - the whole source object just goes black and ignores ALL transparency.EDIT:
Here are the code snippets;
var b:UIComponent = new UIComponent();
b.graphics.beginFill(color, opacity);
[code].....
View 3 Replies
Jan 21, 2010
I am having problems dealing with the alpha channel of an image. Basically I do this:
1. I load an image (.png) and keep it in a bitmap:...
[Code]...
View 4 Replies
May 6, 2010
I believe this is esentially a math problem that may be easy for most of the programmers out there, but I am stuck. I have a fixed rectangle width = 50 height = 50 centered in the middle of the stage. I am using this rectangle to copyPixels of a bitmap that is also centered on the stage. The bitmap is draggable. I can define the initial x,y of the rectangle used for copyPixels with
[Code]...
View 1 Replies
May 19, 2010
I am trying to copy pixels from a user scaled bitmap into a 50x50 target area. I am not seeing the new bitmap does not reflect the scaling of the initial bitmap.
function onSliderChange(e:SliderEvent):void
{
scaleClip(slider.value, dynamicX, dynamicY);
dynamicX = holder_mc.x;
[code]....
View 2 Replies
Oct 4, 2010
I'm loading a batch of 50 jpgs and once loaded, on enter frame, I'd like to change their alpha individually and apply BlendMode.ADD to all of them (also individually).
I can do this easy using normal Sprite objects, but this is not efficient enough (processor wise). I've played a bit with BitmapData.draw(source, null, null, BlendMode.Add) and that's still not efficient enough.
So I was wondering if I could achieve similar effect using copyPixels (which I know should be more efficient). Still, I'm a bit clueless on how could I apply BlendMode and alpha on a bitmapData object (I mean, I know I can't, but I was wondering if I could make this work using Matrix and filter manipulations).
View 8 Replies
Nov 7, 2010
What do you think about mixing this two up? Would it lead to better performance for the scenario described below?However, method done below still contains jerking/stuttering in animationWhat my app does is to create a random mix of smiley and draw it into the canvas, and update the movement of the smiley (x,y)I have a source bitmapdata containing different smileys each of the same size.Example:The app creates a random mixture of smileys inrandom length;Example:tc...I have 2 vector that acts as pool. 1 vector is to store bitmapdata1 vector to store SmileyObject (SmileyObject has 3 properties, positionX, positionY,bitmapData)If the pools is empty, I create a new bitmapdata and SmileyObjectThe bitmapdata copypixels random smileys from the source bitmapdata.This is then placed into SmileyObject.I have a loop that goes through each smiley objectand copypixel each bitmapdata into the canvas along with the x,y position.However, even with copypixel and pooling bitmapdata + smiley object,I can still view the stutter / jerk / stuttering / jerking in the smiley animation.
View 6 Replies
Mar 18, 2011
I am working on my own Molehill 2D painting classes. I took a look at Ely Greenfield's M2D stuff but I found it a tad overkill for what I am looking for. So I want to do my own. I have been working off of Polygonal's example. You can check out my code here - http:[url]..........Assume I want to paint one entity that is a rectangular bitmap image using two triangles (essentially a quad). Basically I am having a hard time understanding how to translate this:
Code:
bitmapData.copyPixels( sourceBitmapData, sourceRectangle, destinationPt.. );
to this (assuming I am using a x, y, u, v vector pairing):[code]...
Specifically if the source rectangle doesn't contain the same values of the sourceBitmapData.rect. What if I want to paint only a portion of a bitmap onto a quad? Or stretch a portion of the image across a quad.
View 1 Replies
Feb 7, 2010
I'm trying to know if you can copy the pixels of many objects in one BitmapData without a huge slowdown. The slow down is made by calling the method multiple times, thus making a lot of variable declaration and disposal for the garbage collector. If someone know how to either immitate the copyPixel method or have any other way of solving this problem,
View 4 Replies
Feb 21, 2009
is copyPixels not as speedy as it should be when Tweening large bitmaps ?
copyPixels does a wonderful job on images 500x500 or less, but on larger images, my motion is not as smooth.
all i'm trying to do is slide an image from stage.stageWidth to 0 (right to left).
View 1 Replies
Aug 15, 2010
how to convert an exact point on a 2d grid to an isometric grid with the following function:
code:
function convertToIso(pointSent:Point) {
var returnPoint:Point=new Point((pointSent.x- pointSent.y),(pointSent.x+pointSent.y )/2);
[Code].....
View 1 Replies
Jul 25, 2011
Am updating a 2D game I made to have an isometric view, problem is am having issues when converting the 2d coordinates of given movieclips into isometric ones. The way I converted my game into an isometric one is just by rotating rectangular graphic 45 degrees and increasing its width such that its 2 times the height.I having problems converting all my 2D coordinates into isometric ones.Is there a function to convert them, or a mathematical formula I could use? by the way the game am making is not tile based, so functions that use tiles to convert the coordinates are not going to work unfortunately.
EDIT: I managed to fix it, I just changed the alignment to be the upper left corner, i.e. though the game is isometric and has a demimonde shape, I imagined that it is contained in a box, and that box's upper left edge is where it is aligned...this way both x and y coordinates r the same ones in both 2D and "isometric" view.
View 2 Replies
Nov 7, 2007
I've been reading a bunch of the tutorials about using isometric in flash but they all seem to have one thing in common. They all use the arrow keys for movement. I've been trying to use the mouse for movement but have only met with frustration so far. I can get the movement to work but then the object collision on the tiles doesn't work or vise versa.
View 2 Replies
Jun 5, 2009
Using a matrix I'm tyring to turn a square into an isometric tile by skewing it upwards (y -30) and skewing it to the right (x + 60). This does giv the desired angles but the sides of the square are stretched and become incongruent. Is there some way to lock the sides from stretching when skewed with a matrix? Pictures speak loouder than words, the shape on the right is what I get and below it shows what I want: [URL]
View 9 Replies
Apr 9, 2010
I need rotate an isometric object by actionscript.
View 3 Replies
Jul 15, 2011
I've built a grid of tiles using a bunch of variables and arrays, but what do I have to do to make it isometric?
As a note, I've done a few searches on isometric games, but none of their placement methods have worked so far (I don't know why).[code]....
View 4 Replies
Feb 20, 2011
I'm new to flash but have plenty of experience developing games, so when I started in flash I ignored pretty much everything that flash could do and just created a buffer the same size as my flash movie and drew my game direct to that with copyPixels. Now what I want to do is to add a menu to the game and it seems sensible to do make use of flash a little more. I can build a menu no problems in a .fla but can anyone tell me how I can render it over the top of my game?
View 2 Replies
Nov 18, 2010
setPixels and copyPixels, bound to original rectangles and points?
View 0 Replies
Oct 9, 2011
I would like to know if its possible to create an isometric animation in flash like the example below. In case I want to create an isometric figure like the first two objects shown and by mouseover they should lift up to the last figure shown. Its no problem to create the basic figures with Photopshop, but I dont know how to animate them in flash cs5.
View 12 Replies