The Daily Click ::. Forums ::. Klik Coding Help ::. FAST LOOPS
 

Post Reply  Post Oekaki 
 

Posted By Message

Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
4th May, 2009 at 18:18:18 -

So; I am a veteran clicker but i don't know so much about fastloops. One thing that's been bugging me is that i feel kinda retarded not knowing how to make a looped movement. I know the regular custom movement taht is laggy and buggy but capable of slopes but nov I've realised that there is more to it than the slopes. My problem is that there apparantly is not a single good tutorial on fastloops out there. I bet it exicts, but I can't find it. PLease help!

 
Professional vaporware developer

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
4th May, 2009 at 19:43:20 -

To break it down really easy, a fast loop is nothing but a way to call for a bunch of events to repeat within 1 main loop.

So for example:
Start
Always: Add 1 to Counter
End

In this example, you'll notice every frame, the counter goes up by 1.

A fast loop however:
Start
Always: Start loop "Add" 5 times.
On loop "Add": Add 1 to Counter
End

In this example every frame, the counter now jumps 5 instead of 1. This is because it's repeating the looped event 5 times.

Now what's interesting is, you can stop fast loops if the conditions for that loop suddenly don't exist.

For example:
Object overlaps backdrop: Start loop "Move up" 32 times.

On loop "Move Up",
+Object overlaps backdrop: Move Object up 1.

On loop "Move Up",
+Object NOT overlaps backdrop: Stop loop "Move up".

This actually means that every loop, it's checking to see if it is, or isn't overlapping the backdrop. If it suddenly stops overlapping the backdrop mid-loop, the loop will cease and the object will stop moving up. This is used to avoid the "sinking" in platforms, because it means that you can have the player sink deep into the ground, and make a fast loop that always kicks the player back up and flush onto the platform.

I'll try to make an example for you if this was too hard to understand.

 
http://www.facebook.com/truediamondgame

Devernath



Registered
  04/12/2004
Points
  54

VIP Member
4th May, 2009 at 19:49:20 -

So, what are some common uses for fastloops that couldn't be done with regular loops?

I think also the fact that theres no help file in the fastloop extension leads to confusion

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
4th May, 2009 at 19:50:15 -

Also make sure that the "loop" event is at the top of the event stack, otherwise it won't work.
But I'm sure you already knew that.

 
n/a

Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
4th May, 2009 at 20:09:39 -

Actually i knew all that Brandon, but thanks a lot anyways. I was... wait a min. I HAVE an example somewhere deep in the vast mountains of unsorted files I think. HOWEVER I did NOT know it had to be on the top! Why?

 
Professional vaporware developer

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
4th May, 2009 at 20:25:48 -

because that is the first event mmf checks before checking the rest.
There is more info about how mmf handles events at these links-
http://www.create-games.com/article.asp?id=1937
http://www.create-games.com/article.asp?id=1942
http://www.create-games.com/article.asp?id=1798

make sure to rate these articles 5 stars if you find them helpful

Edited by UrbanMonk

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
4th May, 2009 at 20:37:39 -

If you want to move an object faster than 1 pixel per MMF loop (ie reading through the events and updating the screen once) it might end up inside or even passing through a obstacle before MMF gets around to checking for collisions.
With a fastloop you can get around that problem by still moving one pixel and checking for collisions but running the fastloop as many times as you like. All within a single MMF loop.

 
.

Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
4th May, 2009 at 20:44:46 -

Thanks for all the help guys!

OMGWTF thirteen thousand creds?!?? How the lol?

Edited by Knockturnal

 
Professional vaporware developer

~Matt Esch~

Stone Goose

Registered
  30/12/2006
Points
  870

VIP Member
4th May, 2009 at 22:31:48 -

Fastloops are also useful when you don't know how much you need to move your object by. There are 2 main approaches to dealing with a movement (specifically collision detection)

1) move then push back: so imagine a player falling. When he hits the ground (or collision detector touches the ground), first of all you make the downwards movement stop, and then using a fastloop, you move the character up 1 pixel at a time until he is not sticking into the ground.

2) you may notice a problem with option 1: if you're player was falling really fast, he might miss the ground all together. One moment he is above a platform, and then he moves down 32 pixels and now he is below the platform. In this case we would prefer to move the character down 1 pixel at a time. So if I want to move my character down 32 pixels, a fastloop moves him down 1 pixel 32 times, and in the mean time I am able to check for collisions inbetween.

Personally I use option 2 with a slight twist: I move more than 1 pixel at a time, but just enough. This is much more efficient if I know it is safe to move 6 pixels down at a time or something like that.

Edited by ~Matt Esch~

 
http://create-games.com/project.asp?id=1875 Image


Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
4th May, 2009 at 22:40:18 -

Thanks again. Fast, direct and informative replys everyone! Best place if you need kliking help, no doubt

 
Professional vaporware developer

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
4th May, 2009 at 22:42:48 -

Indeed it is

 
n/a
   

Post Reply



 



Advertisement

Worth A Click