1 favourites



Get emailed when there are new posts!


  • 602 words
  • ~2-4 mins read time
  • Published
  • 1,470 visits
  • 6.4 visits per week
  • 2,101 page views


This blog post is licensed Creative Common Attribution Required v4.0.


Enjoy this blog? Share with your contacts!

Share now

Ok, lets jump into it.

What we Need?

2 global Variables, 3 sprites, 1 tiledbackground and a couple of behaviors

the first global variable we call it PowerUP and leave its value to 0

the 2nd global variable we call it powerupCountdown and leave its value to 0

the 1st sprite we create a circle in its animation and color it yellow as for a coin, and additionally we named it Coin, on top of that we set a boolean called Magnet and leave the default value to false.

The 2nd sprite we create a little square or a circle blue icon with a arrow on it so we know is a powerup type of item, then we call it powerup.

The 3rd sprite will be our player, name it that way, and add to it the platform behavior.

The tiledbackground we give it some color we want our ground floor to be, and trow the behavior solid on it and place it as the ground on the layout so our player can sit on it.

The coin we place a bunch of them so we can have a large area of coins to collect something like bellow.

I also cloned the tiledbackground a few times and created a few platforms in there so the player can jump up to the top coins that he wont normally reach.

If we run the game now the player will move but nothing will happen, so now we move to the eventsheet

And We add a condition and compare our powerup variable if is active or not.

Action: Set Boolean Magnet to true

Condition: Coin on collision with Player Action: Coin Destroy

Now we have to compare if the player collected the powerup item and trigger the countdown for the powerup active time that will enable the coin to be attracted to the player and we do that by the following.(if you didn't put the powerup item in the layout take a look at the picture above and do something similar as placement goes.)

Next we need to take care of the timer

If you followed the text to this far correctly you should have your event sheet looking something like bellow.

And if we running a preview now, we will see the coins will start following the player if its in the range of 200 pixels or lower, but not after he picked the powerup item.

And this concludes this entry blog, if you didn't managed to understand a word from the pseudo-code above don't worry, there is always a file download like somewhere here.

"Filezzzz! " - Download


  • Order by
Want to leave a comment? Login or Register an account!