I have decided to pick 'The Adjustment Bureau' as a website project, and as part of getting some ideas together I have been tinkering with actionscript to test out a few of those ideas.
One of them being a camera/surveillance type effect, with crackling/rolling scan lines.
So what I have done is have two pictures, one being the actual image i want the effect on, and the other is a image of scan-lines or you could have a load of tv snow, fuzz, whatever. Scan-lines seem to work good for this though.
Then its just a matter of overlaying the scan image ontop of the original and mucking about with the alpha settings and in my case, i am also changing the y scale and height placement of the image. I do this in a loop and every change is randomized to some extent so that it looks as real as possible without looking like a simple repeated pattern.
The .swf is here if you want to have a look..
http://www.internalimage.co.uk/screen-fuzz.swf
Here is the code: There are two alternates in there, the first being whether or not to do the fuzzy effect, and the other decides whether to do a 'sliding down screen' effect or just a random anywhere one..
var vAlpha = 100;
var vScale = 0;
var bScroll = 0;
var bRotate = 0;
var startTime:Number;
var waitTime:Number;
var doFuzz = false;
startTime = getTimer();
waitTime = Math.ceil(Math.random()*1000);
onEnterFrame = function() {
//toggle between doing fuzz and not to give more randomness
if( (getTimer() - startTime) > waitTime)
{
if(doFuzz == false) doFuzz = true; //switch flags
else{
doFuzz = false;
picfuzz._alpha = 0; //hide the fuzz!
cctvpic._alpha = 100; //full show on pic
}
startTime = getTimer(); //reset timer
waitTime = Math.ceil(Math.random()*10000) + 1; //set a new random time delay
if(doFuzz == true) waitTime = waitTime / 2;
}
if(doFuzz == true)
{
// picfuzz._y += 1;
bScroll = Math.ceil(Math.random()*25);
if(bScroll <= 10)
{
picfuzz._y = cctvpic._y + Math.ceil(Math.random()* cctvpic._height-40);
picfuzz._yscale = Math.ceil(Math.random()*60);
picfuzz._alpha = Math.ceil(Math.random()*35);
// cctvpic._alpha += 1; //Math.ceil(Math.random()*25);
}
else
{
picfuzz._y += 1; //cctvpic._y + Math.ceil(Math.random()* cctvpic._height-50);
picfuzz._yscale += 1;// = Math.ceil(Math.random()*40);
picfuzz._alpha += 1; //Math.ceil(Math.random()*25);
cctvpic._alpha = Math.ceil(Math.random()*25) + 75;
}
}
}
Introduction to our course
Welcome to my blog, Digital Communications, which will document my progress and activities throughout the BTEC Interactive Media course.
Saturday, 12 February 2011
Wednesday, 2 February 2011
Basic game movement in flash actionscript a la PacMan!
Hi,
Been playing around in actionscript. Got multi-dimensional arrays working so that means I can define a maze level in this array and have the code traverse this and display the relevant blocks of the maze (in this case its just either a wall or nothing).
Using the same array I am able to move the player about and detect if there is a wall in the way and block the movement.
The green and red are done in the same way, except for the their movement, it is simply a random number between 1-4 which determines which way they will try to move (1=left, 2=right, 3=up, 4=down).
It's a basic example of using arrays to track movement and collisions. Think Pac-Man!
You could for instance have sections of the grid that are power-ups/keys etc. which when you move over them change something. You just check which position you are on the grid, look into the array at this position and get what's there.
chris
grid based movement using arrays |
Using the same array I am able to move the player about and detect if there is a wall in the way and block the movement.
The green and red are done in the same way, except for the their movement, it is simply a random number between 1-4 which determines which way they will try to move (1=left, 2=right, 3=up, 4=down).
a code snippet |
You could for instance have sections of the grid that are power-ups/keys etc. which when you move over them change something. You just check which position you are on the grid, look into the array at this position and get what's there.
chris
Tuesday, 1 February 2011
Magic Pen - a flash game review
Starts easy enough.. |
We’ve all heard of these physics games which are quite popular especially on the indie and casual games circuit, except this one has a neat little twist. The object of the game is to solve the puzzle, and what is the puzzle you might ask? To solve each level you simply have to get the red ball into the flag area. So how do you do that then I hear you ask? Well this is where it gets interesting because in order to do that, you need to construct various shapes, ramps, levels and pulley systems in order to get the ball moving! You draw out all these shapes with the ‘Magic Pen’ of the title, and it couldn’t be easier. Want a circle? Draw one and there it is… A square? Four lines, done.. Triangle? Go ahead!
The first few levels are quite easy and this serves well to familiarise yourself with some of the basics of the game. Build a couple of ramps here and there, a nicely placed rock with a make-shift pulley system and then draw a big rock in mid air which will then drop nicely onto the pulley and thus catapult the ball into the finish area (or no-where land if you’ve over done it just slightly!).
The difficulty level is set fairly well so it manages to keep your interest without getting too hard or frustrating (and this it will do!)
It’s definitely one of those games that gets you thinking as well as being fun. And once you get to those hard levels, the re-play factor is there as you just want to keep trying to solve the level!
It also a good example of what can be done in Flash too as it is obviously dealing with some quite complex physics maths and rendering in there.
It also a good example of what can be done in Flash too as it is obviously dealing with some quite complex physics maths and rendering in there.
Try the game out for yourself here: http://www.bubblebox.com/play/puzzle/975.htm
Or watch a video clip: http://www.youtube.com/watch?v=2g7rbZ4OMU8
Or watch a video clip: http://www.youtube.com/watch?v=2g7rbZ4OMU8
Subscribe to:
Posts (Atom)