Mobile Maze Application for on Android devices

Creating Games? Developing something for fun?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

laurabar55
Posts: 26
Joined: Tue Mar 18, 2014 11:10 pm

Mobile Maze Application for on Android devices

Post by laurabar55 » Tue Mar 18, 2014 11:19 pm

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?

Simon
VIP Livecode Opensource Backer
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

Post by Simon » Wed Mar 19, 2014 12:14 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

laurabar55
Posts: 26
Joined: Tue Mar 18, 2014 11:10 pm

Re: Mobile Maze Application for on Android devices

Post by laurabar55 » Tue Mar 25, 2014 3:29 am

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?

Simon
VIP Livecode Opensource Backer
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

Post by Simon » Tue Mar 25, 2014 3:51 am

I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

laurabar55
Posts: 26
Joined: Tue Mar 18, 2014 11:10 pm

Re: Mobile Maze Application for on Android devices

Post by laurabar55 » Tue Mar 25, 2014 4:17 am

"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?

Simon
VIP Livecode Opensource Backer
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

Post by Simon » Tue Mar 25, 2014 6:03 am

Hi laurabar55,
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!

laurabar55
Posts: 26
Joined: Tue Mar 18, 2014 11:10 pm

Re: Mobile Maze Application for on Android devices

Post by laurabar55 » Sat Mar 29, 2014 1:21 am

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

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Mobile Maze Application for on Android devices

Post by sefrojones » Sat Mar 29, 2014 5:00 am

Laura,


Just a guess, but are you running livecode 6.6? Have you tried to compile your standalone in 6.5.2?

--sefro

laurabar55
Posts: 26
Joined: Tue Mar 18, 2014 11:10 pm

Re: Mobile Maze Application for on Android devices

Post by laurabar55 » Sat Mar 29, 2014 5:35 am

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.

laurabar55
Posts: 26
Joined: Tue Mar 18, 2014 11:10 pm

Re: Mobile Maze Application for on Android devices

Post by laurabar55 » Sun Mar 30, 2014 5:33 pm

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

Simon
VIP Livecode Opensource Backer
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

Post by Simon » Sun Mar 30, 2014 11:19 pm

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:

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
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

Code: Select all

on closeCard
if the environment = "mobile" then
   mobileDisableAccelerometer
end if
end closeCard
Better
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

laurabar55
Posts: 26
Joined: Tue Mar 18, 2014 11:10 pm

Re: Mobile Maze Application for on Android devices

Post by laurabar55 » Mon Mar 31, 2014 1:22 am

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

Simon
VIP Livecode Opensource Backer
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

Post by Simon » Mon Mar 31, 2014 1:38 am

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 used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

laurabar55
Posts: 26
Joined: Tue Mar 18, 2014 11:10 pm

Re: Mobile Maze Application for on Android devices

Post by laurabar55 » Mon Mar 31, 2014 2:00 am

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

Simon
VIP Livecode Opensource Backer
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

Post by Simon » Mon Mar 31, 2014 2:47 am

You are getting closer but
move image "marble"(pXAccel,2)
that comma 2 is for the round function only.

Again...
you know how to set the location
.... hint hint hint

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!

Post Reply

Return to “Games”