Search This Blog

24 March 2011

Light and pressure activated animations

So today we were tasked with making a Light interactive flash app. I missed last week so I need the script for flash. I am using Flash CS5 Action Script 2.0

It is as follows:


onClipEvent (enterFrame) {
if (!Key.isDown(80)){
_root.play();
}
}

so that means if key 'P' is pressed, the movie plays.
We have a image of TNT and when the image plays, the timer counts down from 10, then there is an explosion. Pretty simple but this is the first project we have completed.

Then we have to set up a light sensor. A simple light sensor, taped up to two cables. They would be connected to a port and then put into the computer. The sensor would be placed in the end of a biro pen with a small hole cut in it to allow a small amount of light in. 
Then we have a laser which will be pointed at the sensor. When the beam is broken, the animation plays. Simples!

I'm going to get the other Action Scripts and post them here. So there will be pressure sensitivity, camera and sound interaction. Just for reference :)

Edit: It works!!
See below!

The final animation







This is the tool which we plugged
the light sensor into.
It goes into USB.
The business end of the same object
it has a midi port.

This is the 'laser' we used. A simple light pen.
It took ages to align it with the light sensor.
It was taped down well
The light sensor
The light sensor in action. It is inside the pen cap
and taped to the leg of a table
Guy setting up the laser pen


_______________________________________________________________________________

The week before I was away, however the group informed me that we were tasked with creating a pressure activated animation. As our group has an odd sense of humour, they chose to have Bella (from that gawd-awful Twilight Book and Movie series) which you can 'punch in the face' by hitting the pressure pad.

The set-up was the same (sensor attached to that USB-chip thing) with the same coding.


onClipEvent (enterFrame) {
if (!Key.isDown(80)){
_root.play();
}
}

Now obviously the pressure pad is assigned to P

--The general idea here was to have two pressure pads, one would be for each side of the face. When you press the left pad the animation (getting more and more beaten up and bruised) would advance by one frame, and likewise for the right pad and the right side of the face animation. We had several problems trying to implement this: the first is that we could not get hold of two pressure pads. Secondly, we could not get the animation to advance by one frame only. Thirdly, the sound effect we wanted to add to the code, would not play once, it would play constantly.

0 comments:

Post a Comment