Page 3 of 3

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 5:58 am
by laurabar55
Hi, so I got rid of the intersect part and just had the repeat code in there, but it got all locked up.
should I do something like this then, or are you telling me to get ride of the intersect idea all together?

if intersect(image "maze", image "p3", "opaque pixels") then
set the left of group "pie" to the left of group "pie" - 2
repeat until not intersect(image "maze", image "p3", "opaque pixels")
add 1 to tMove
end repeat
end if


sorry if I am way off track. I am trying

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 6:01 am
by laurabar55
No, that doesn't work either. it still locked up.

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 6:08 am
by Simon
YES!
followed by a
WOW!

Yes off track.

The code you started with is correct, I just was changing that -10
tMove has to do with "set the left..." to a small number and keep building it till it no longer intersects.

Simon

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 6:13 am
by laurabar55
I tend to complicate things ... and make it harder than it actually is. Lol

Is this what you mean then?

if intersect(image "maze", image "p2", "opaque pixels") then
set the left of group "pie" to the left of group "pie" tMove
end if

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 6:22 am
by laurabar55
nope that doesn't work at all.

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 6:23 am
by Simon
RATS RATS RATS!

OK you beat me!

if intersect(image "maze", image "p3", "opaque pixels") then
repeat until not intersect(image "maze", image "p3", "opaque pixels")
add 1 to tMove
set the left of group "pie" to the left of group "pie" - tMove
end repeat
end if

And where are my image names, how can I tell if it's moving in the correct direction?

I'm crap at teaching :x

Now I refuse to tell you any more until you explain what this line does:
repeat until not intersect(image "maze", image "p3", "opaque pixels")

Simon

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 6:40 am
by laurabar55
That line means that it is to repeat moving the marble to the left until the marble no longer intersects with the maze walls. That way if it keeps moving to the left it will not go through the wall.

is that the correct answer

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 6:56 am
by Simon
Sure... I think.

How is it working?

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 7:13 am
by laurabar55
It work pretty good, but if it touches the wall for two long the marble jumps to a random location.

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 7:23 am
by Simon
yeah, you have to limit the x,y so that it can't go past say +5 px. That will reduce the velocity, not perfect.

Simon

Re: Mobile Maze Application for on Android devices

Posted: Wed Apr 09, 2014 7:41 am
by laurabar55
I know this is probably wrong, but would I do that like this?

if intersect(image "maze", image "p1", "opaque pixels") then
repeat until not intersect(image "maze", image "p1", "opaque pixels")
add 1 to tMove
pXAccel +5
set the right of group "pie" to the right of group "pie" - tMove
end repeat
end if

Re: Mobile Maze Application for on Android devices

Posted: Thu Apr 10, 2014 12:51 am
by laurabar55
Hi Simon,
so I fully get that you don't want to give me all the answers. but can you give me more of a hint on how to do the x and y so that it doesn't go through the walls. I know that thing I sent you doesn't work because I tested that, and i have tried a few other things with no luck.

thanks,

Laura

Re: Mobile Maze Application for on Android devices

Posted: Thu Apr 10, 2014 5:51 am
by laurabar55
if intersect(image "maze", image "p2", "opaque pixels") then
repeat until not intersect(image "maze", image "p2", "opaque pixels")
add 1 to tMove until tMove = +5
set the top of group "pie" to the top of group "pie" - tMove
end repeat
end if

then I tried this
if intersect(image "maze", image "p2", "opaque pixels") then
repeat until not intersect(image "maze", image "p2", "opaque pixels")
add 1 to tMove until y=5
set the top of group "pie" to the top of group "pie" - tMove
end repeat
end if

Can you let me know if any of these that I have done is on the right track?

Thank you :)

Laura