Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Action Script 3.0

Name: Anonymous 2012-11-20 17:53

I have a problem in flash professional/action script 3.0. I have a plane that is suppoused to fly in from the side, and it works fine with the plane i have called "flySnill", but it doesn't with "flySlem" although I have written the same code for both of them. Is anyone of you able to identify the problem? I'm very new to action script as you might understand, so please don't hate. I'm truly sorry if this is the wrong board.
Here is the code:

stage.addEventListener(MouseEvent.MOUSE_MOVE, musFlytt);
stage.addEventListener(MouseEvent.CLICK, skyt);
stage.addEventListener(KeyboardEvent.KEY_DOWN, nyttMål);
addEventListener(Event.ENTER_FRAME, tikk);

Mouse.hide();

var fartY = 0;
var fartX = 0;
var level = 10;
var bakkenivå = 0;
var poeng = 0;
var skudd = 0;

function musFlytt(evt)
{
    sikte.x = mouseX;
    sikte.y = mouseY;
    if(sikte.y > 250)
    {
        sikte.y = 250;
    }
}

function skyt(evt)
{
    skudd = skudd + 1;
    sikte.gotoAndPlay(2);
    var treffSnill = sikte.hitTestObject(flySnill);
    var treffSlem = sikte.hitTestObject(flySlem);
    if(treffSnill == true)
    {
        flySnill.gotoAndPlay(2);
        poeng = poeng - 1;
    }
    if(treffSlem == true)
    {
        flySlem.gotoAndPlay(2);
        poeng = poeng + 1;
    }
    txtPoeng.text = "Antall poeng: " + poeng;
    txtSkudd.text = "Antall skudd: " + skudd;
}

function nyttMål(evt)
{
    var tast = evt.keyCode;
    if(tast == 32)
    {
        flySnill.x = bakkenivå;
        fartX = level;
        flySnill.y = Math.random()*300 + 125;
        fartY = Math.random()*level*2-level;
        flySnill.gotoAndPlay(1);
    }
    if(tast == 27)
    {
        flySlem.x = bakkenivå;
        fartX = level;
        flySlem.y = Math.random()*300 + 125;
        fartY = Math.random()*level*2-level;
        flySlem.gotoAndPlay(1);
    }
}

function tikk(evt)
{
    flySnill.x += fartX;
    flySnill.y -= fartY;
}

Name: Anonymous 2012-11-20 18:04

What's with all the homework threads lately? It got worse since they put that link on /g/.

Name: Anonymous 2012-11-20 18:08

Actionshit
People still use Flash?

Name: Anonymous 2012-11-20 18:11

Name: Anonymous 2012-11-20 18:13

noko
Back to le imagereddits, ``please''.

Name: Anonymous 2012-11-20 19:55

*
"GRUNNUR";

Name: Anonymous 2012-11-21 13:34

/g/ helped me, I will do you all a favour. I won't come back to this board untill i have learned a real programing language, atleast to some extent.

Name: Anonymous 2012-11-21 13:39

>>7
They would, wouldn't they?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List