# Timed powerup

**URL:** <https://forum.kirupa.com/t/timed-powerup/235934>\
**Category:** Uncategorized\
**Created:** [August 15, 2007, 9:02pm UTC](https://forum.kirupa.com/t/timed-powerup/235934 "2007-08-15T21:02:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Icezizim](https://avatars.discourse-cdn.com/v4/letter/i/b9e5f3/32.png) [@Icezizim](https://forum.kirupa.com/u/Icezizim)\
**Post date:** [August 15, 2007, 9:02pm UTC](https://forum.kirupa.com/t/timed-powerup/235934/1 "2007-08-15T21:02:36Z")

</div>

iv already tried myself to use setinterval() to make it call a function for a timed powerup. like you would touch the powerup and after 5 seconds it would go back to the original value. heres what i tried,

```php

onClipEvent(load){

function slowdownloop() {
        if (counterloop >= 5){
            for (var i = 0; i<61; i++) {
                _root["enemys"+i].enemys.divspeed = 100;
            }
            counterloop = 0;
            clearInterval( loopint );
        } else {
            for (var i = 0; i<61; i++) {
                _root["enemys"+i].enemys.divspeed = 500;
            }
            counterloop++;
        }
    }
}

onClipEvent(enterFrame){

if (checkCircleCollision(_root.ball, _parent)) {
        loopint = setInterval( slowdownloop, 1000);
        removeMovieClip(_parent);
    }
}

```

it doesnt work right though, it will set the divspeed to 500, then set it to 100, and just loops like that. i wanted it to just set divspeed to 500 for 5 seconds then set it too 100. can anyone fix it or write new code that does what i want? thanks :beam:
