-
Loop Problem
This is not MMF2 Specific I cannot not get it to work in 1.5 either. I am sure it is an event error on my part....however,
I am trying to basically make a row of the same objects move to the right until the right most object hits the side of the screen then reverse itself (Think Space Invaders). The loop function cannot seem to recognize a sub-requirement of leaving the play area:
Start of Frame Set Global Value A to 10
Always spread 0 to Alt Value A of Active1
Always Do Loop "Active1 Pos" Active1 number of times
On Loop "Active1 Pos"
Active1 Alt Value A = Loop Index Count
Active1 Leaves play area on Right
Set Global Value A to -10
On Loop "Active1 Pos"
Active1 Alt Value A = Loop Index Count
Active1 Leaves play area on Left
Set Global Value A to 10
Every 00"-30 Set X Pos of Active1 to Current X Pos of Active 1 + Global Value A
I even have a counter on screen to show if the Global Value changes so that I can make sure that my movement was not messed up. It never changes so the 'Leaves the Play area" requirement is never being seen.....If I change the leaves play area to something like is inside play area it will recognize it. I have done this by adding a sound to the event instead of changing the movement. It makes the sound all day.
Help
-
Loop Problem
This is not MMF2 Specific I cannot not get it to work in 1.5 either. I am sure it is an event error on my part....however,
I am trying to basically make a row of the same objects move to the right until the right most object hits the side of the screen then reverse itself (Think Space Invaders). The loop function cannot seem to recognize a sub-requirement of leaving the play area:
Start of Frame Set Global Value A to 10
Always spread 0 to Alt Value A of Active1
Always Do Loop "Active1 Pos" Active1 number of times
On Loop "Active1 Pos"
Active1 Alt Value A = Loop Index Count
Active1 Leaves play area on Right
Set Global Value A to -10
On Loop "Active1 Pos"
Active1 Alt Value A = Loop Index Count
Active1 Leaves play area on Left
Set Global Value A to 10
Every 00"-30 Set X Pos of Active1 to Current X Pos of Active 1 + Global Value A
I even have a counter on screen to show if the Global Value changes so that I can make sure that my movement was not messed up. It never changes so the 'Leaves the Play area" requirement is never being seen.....If I change the leaves play area to something like is inside play area it will recognize it. I have done this by adding a sound to the event instead of changing the movement. It makes the sound all day.
Help
-
Re: Loop Problem
leaving the play area i think only works with built-in movements. You will need to check if position X is greater than something (in this case the windows size) or lower than 0 perhaps?
same with collides and overlaps. Collides only works with built in movements, while overlaps is a general condition.
-
Re: Loop Problem
leaving the play area i think only works with built-in movements. You will need to check if position X is greater than something (in this case the windows size) or lower than 0 perhaps?
same with collides and overlaps. Collides only works with built in movements, while overlaps is a general condition.
-
Re: Loop Problem
Yes, use "X position > Frame Width" and "X position < 0" instead of the "Leaves the Play Area" events.
-
Re: Loop Problem
Yes, use "X position > Frame Width" and "X position < 0" instead of the "Leaves the Play Area" events.
-
Re: Loop Problem
I did not think about frame width. I ended up putting a border on the two edges. I merely made a thin black line for now and used a collide and it did what I wanted it to. However, I am going to try the width. I already knew that 0 worked so I am pretty sure the width will.
Thanks for the responses,
Wade
-
Re: Loop Problem
I did not think about frame width. I ended up putting a border on the two edges. I merely made a thin black line for now and used a collide and it did what I wanted it to. However, I am going to try the width. I already knew that 0 worked so I am pretty sure the width will.
Thanks for the responses,
Wade