Mobile Maze Application for on Android devices
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 26
- Joined: Tue Mar 18, 2014 11:10 pm
Mobile Maze Application for on Android devices
Hi, I was wondering if anybody could help me. I am making a maze mobile application for a college project. I am only making for now to work on android devices. I have all my mazes designed and in LiveCode, and I know how to make them work on desktop computers with on arrowkey commands.
But I need to get it working using accelerometer scripting. does anybody know where I can start?
But I need to get it working using accelerometer scripting. does anybody know where I can start?
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Mobile Maze Application for on Android devices
Hi laurabar55,
Welcome to the forum!
Here is the start;
http://lessons.runrev.com/s/lessons/m/4 ... al-compass
Now there is plenty in there you don't need but the basics are
mobileEnableAccelerometer
accelerationChanged X, Y, Z
Look both of those up in the dictionary.
If you get stuck just ask here.
Simon
Welcome to the forum!
Here is the start;
http://lessons.runrev.com/s/lessons/m/4 ... al-compass
Now there is plenty in there you don't need but the basics are
mobileEnableAccelerometer
accelerationChanged X, Y, Z
Look both of those up in the dictionary.
If you get stuck just ask here.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 26
- Joined: Tue Mar 18, 2014 11:10 pm
Re: Mobile Maze Application for on Android devices
Hi,
I have some scripting that I want to test on an adroid device. However, when I go to save it as a standalone application, it pops up an error message that it could not compile the application class.
Does anybody know what this means?
I have some scripting that I want to test on an adroid device. However, when I go to save it as a standalone application, it pops up an error message that it could not compile the application class.
Does anybody know what this means?
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Mobile Maze Application for on Android devices
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 26
- Joined: Tue Mar 18, 2014 11:10 pm
Re: Mobile Maze Application for on Android devices
"com.laurabar55.mazeapp"
I'm sorry but I have tried putting numerous things in that line, like what I have above. I don't exactly know what I am supposed to put in that section?
I'm sorry but I have tried putting numerous things in that line, like what I have above. I don't exactly know what I am supposed to put in that section?
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Mobile Maze Application for on Android devices
Hi laurabar55,
Are you able to build and test a "Hello World" stack?
Simon
Are you able to build and test a "Hello World" stack?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 26
- Joined: Tue Mar 18, 2014 11:10 pm
Re: Mobile Maze Application for on Android devices
Hi, I was working on my maze in Livecode and now the "edit pointer tool" is working the same as the "run browse tool".
Any ideas why? and how I can fix this? because I can't do any scripting, or editing of my mazes now.
Thanks,
Laura
Any ideas why? and how I can fix this? because I can't do any scripting, or editing of my mazes now.
Thanks,
Laura
-
- Livecode Opensource Backer
- Posts: 447
- Joined: Mon Jan 23, 2012 12:46 pm
Re: Mobile Maze Application for on Android devices
Laura,
Just a guess, but are you running livecode 6.6? Have you tried to compile your standalone in 6.5.2?
--sefro
Just a guess, but are you running livecode 6.6? Have you tried to compile your standalone in 6.5.2?
--sefro
-
- Posts: 26
- Joined: Tue Mar 18, 2014 11:10 pm
Re: Mobile Maze Application for on Android devices
I think I clicked something that didn't allow me to make any changes. But luckily, I found a duplicate copy, that I just had to re-script a few things on. Thanks though.
-
- Posts: 26
- Joined: Tue Mar 18, 2014 11:10 pm
Re: Mobile Maze Application for on Android devices
Hi, Now that I have been able to test my maze on an Android tablet, I am having troubles getting the marble to move.
Can someone help me with this.
Here is the advice I was given already, but I can't get anything to work.
Here is the start;
http://lessons.runrev.com/s/lessons/m/4 ... al-compass
Now there is plenty in there you don't need but the basics are
mobileEnableAccelerometer
accelerationChanged X, Y, Z
Look both of those up in the dictionary.
my marble is called image "marble". and I want it to roll through the maze. how would I script it to do so?
thanks
Laura
Can someone help me with this.
Here is the advice I was given already, but I can't get anything to work.
Here is the start;
http://lessons.runrev.com/s/lessons/m/4 ... al-compass
Now there is plenty in there you don't need but the basics are
mobileEnableAccelerometer
accelerationChanged X, Y, Z
Look both of those up in the dictionary.
my marble is called image "marble". and I want it to roll through the maze. how would I script it to do so?
thanks
Laura
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Mobile Maze Application for on Android devices
Hi Laura,
With these two:
mobileEnableAccelerometer
accelerationChanged X, Y, Z
Can you see that x,y,z will change as you move the device?
Start a new stack with just 3 fields on a card.
in the card script:
I rounded the values because it looks crazy if you don't, but you can take that off.
From there can you see how to set the location of the marble?
Simon
Edit; oops made a boo boo
Better
With these two:
mobileEnableAccelerometer
accelerationChanged X, Y, Z
Can you see that x,y,z will change as you move the device?
Start a new stack with just 3 fields on a card.
in the card script:
Code: Select all
on openCard
if the environment <> "mobile" then exit openCard
get mobileSensorAvailable("acceleration")
if it is false then
answer "Sensor unavailable"
exit openCard
end if
mobileEnableAccelerometer 1000
end openCard
on accelerationChanged pXAccel, pYAccel, pZAccel
put round(pXAccel,2) into fld 1
put round(pYAccel,2) into fld 2
put round(pZAccel,2) into fld 3
end accelerationChanged
on closeCard
mobileDisableAccelerometer
end closeCard
From there can you see how to set the location of the marble?
Simon
Edit; oops made a boo boo
Code: Select all
on closeCard
if the environment = "mobile" then
mobileDisableAccelerometer
end if
end closeCard
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 26
- Joined: Tue Mar 18, 2014 11:10 pm
Re: Mobile Maze Application for on Android devices
Hi thank you so so much for your help
on openCard
set location of image "marble" to 675,167
set the visible of image "instructions2" to false
set the visible of image "close2" to false
if the environment <> "mobile" then exit openCard
get mobileSensorAvailable("acceleration")
if it is false then
answer "Sensor unavailable"
exit openCard
end if
mobileEnableAccelerometer 1000
end openCard
on accelerationChanged pXAccel, pYAccel, pZAccel
put round(pXAccel,2) into fld 1
put round(pYAccel,2) into fld 2
put round(pZAccel,2) into fld 3
end accelerationChanged
on closeCard
if the environment = "mobile" then
mobileDisableAccelerometer
end if
end closeCard
that is the code that I have on my maze now, but I am stuck on how to get my image "marble to roll through the maze? I have tried numerous things, and all I have accomplished is getting to move on touch through the maze (this is my backup plan for handing in my assignment). But, I really want it to roll through the maze using accelerometer scripting.
thanks for all your help,
Laura
on openCard
set location of image "marble" to 675,167
set the visible of image "instructions2" to false
set the visible of image "close2" to false
if the environment <> "mobile" then exit openCard
get mobileSensorAvailable("acceleration")
if it is false then
answer "Sensor unavailable"
exit openCard
end if
mobileEnableAccelerometer 1000
end openCard
on accelerationChanged pXAccel, pYAccel, pZAccel
put round(pXAccel,2) into fld 1
put round(pYAccel,2) into fld 2
put round(pZAccel,2) into fld 3
end accelerationChanged
on closeCard
if the environment = "mobile" then
mobileDisableAccelerometer
end if
end closeCard
that is the code that I have on my maze now, but I am stuck on how to get my image "marble to roll through the maze? I have tried numerous things, and all I have accomplished is getting to move on touch through the maze (this is my backup plan for handing in my assignment). But, I really want it to roll through the maze using accelerometer scripting.
thanks for all your help,
Laura
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Mobile Maze Application for on Android devices
Hi Laura,
I understand what you would like to do.
But you haven't added any scripting to move the marble.
I can see you know how to set the location of the marble so how would you implement the x,y from the accelerationChanged message?
If you have the 3 fields you can see that the numbers change as you tilt the device.
Simon
I understand what you would like to do.
But you haven't added any scripting to move the marble.
I can see you know how to set the location of the marble so how would you implement the x,y from the accelerationChanged message?
If you have the 3 fields you can see that the numbers change as you tilt the device.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 26
- Joined: Tue Mar 18, 2014 11:10 pm
Re: Mobile Maze Application for on Android devices
Hi, ok, so I put those fields in there and yes the numbers in the boxes changes as I move the device.
would I do something like this?
on accelerationChanged pXAccel, pYAccel, pZAccel
move image "marble"(pXAccel,2)
move image "marble"(pYAccel,2)
move image "marble"(pZAccel,2)
put round(pXAccel,2) into fld 1
put round(pYAccel,2) into fld 2
put round(pZAccel,2) into fld 3
end accelerationChanged
I know the move keyword is wrong because it is coming up with an error code.
thanks,
Laura
would I do something like this?
on accelerationChanged pXAccel, pYAccel, pZAccel
move image "marble"(pXAccel,2)
move image "marble"(pYAccel,2)
move image "marble"(pZAccel,2)
put round(pXAccel,2) into fld 1
put round(pYAccel,2) into fld 2
put round(pZAccel,2) into fld 3
end accelerationChanged
I know the move keyword is wrong because it is coming up with an error code.
thanks,
Laura
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Mobile Maze Application for on Android devices
You are getting closer but
move image "marble"(pXAccel,2)
that comma 2 is for the round function only.
Again...
If I'm being just a pain say so, I'd like you to solve this because it will make you much happier.
While I'm saying you are close you still have a lot of work to do, it's not as simple as just using accelerationChanged. You have looked at the numbers coming back from that message?
Simon
move image "marble"(pXAccel,2)
that comma 2 is for the round function only.
Again...
.... hint hint hintyou know how to set the location
If I'm being just a pain say so, I'd like you to solve this because it will make you much happier.
While I'm saying you are close you still have a lot of work to do, it's not as simple as just using accelerationChanged. You have looked at the numbers coming back from that message?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!