Now look back at the events 8, 9, 10 and 11. Where we sense by overlap conditions.
Lets change those. First browser a second in the system objects conditions.
And notice the "Object overlaps point" condition. This is what we gonna use.
No more setting image points too. But its good that you know how to set those. And how to use those. So do not forget that.
ok .. double click the U overlaps Blue condition to change it.
Click back till you are in step1 of the wizard.
Step1: base object = system object.
Step2: condition = "Object overlaps point"
Step3: parameters : the object = Blue (the family we call the walls with)
now X will be an expression. We will point to the x where we positioned the Sensors in last post.
But Where is the X coordinate of the sensor ? without using the sensor ?
Well, the maze is a 40 by 40 grid. Our octopus is in the middle of that grid. So the distance from a maze edge to the Octopus middle point (its X and Y point) is half the 40. Simply 20.
Lets Add 2 pixels to have a save and never failing Overlap Detection.
So X for the up "sensor" = Octopus.X
and Y is Octopus.Y - 22
there ! The sensor objects are eliminated by this. But you need more imagination to see whats happening, and even more to debug if you run into problems.
But, its certainly faster and more CPU friendly.
so ...
point x gets the value Octopus.X
point y gets the value Octopus.Y -22
click finish.
do the same for R overlaps blue.
Xpoint in the parameters is now Octopus.X + 22
Ypoint = Octopus.Y
For D this will be
Xpoint = Octopus.X
Ypoint = Octopus.Y + 22
For L this will be
Xpoint = Octopus.X - 22
Ypoint = Octopus.Y
Now go to the layout editor.
Delete the objects U, R D and L
they will be deleted from the events sheet too
meaning, you will have a few empty always events.
You can delete those.
And run all.
NEVER DELETE OBJECTS BEFORE YOU CHANGED THE EVENTS !!
(hope daddy smiles after this post)