Cannot Find Symbol
in
Android Processing
•
5 months ago
I am stumbling a bit through my code here. The accelerometer and compass work just fine, but my MapMovement class has been causing a "cannot find symbol" error. Below is the code from the body, followed by the code from the tab I created for MapMovement:
- MapMovement move;
- float sp = 0.5;
- int x = width/2;
- int y = height/2;
- AccelerometerManager accel;
- float ax, ay;
- CompassManager compass;
- float direction;
- PImage map;
- void setup()
- {
- accel = new AccelerometerManager(this);
- compass = new CompassManager(this);
- move = new MapMovement(this);
- orientation(PORTRAIT);
- size(600,800,P3D);
- map = loadImage("map.gif");
- imageMode(CENTER);
- }
- void draw()
- {
- background(0,0,100);
- //For Compass
- rotate(direction);
- movement.update();
- }
- //For Accelerometer
- public void resume() {
- if (accel != null) {
- accel.resume();
- }
- }
- public void pause() {
- if (accel != null) {
- accel.pause();
- }
- }
- public void shakeEvent(float force) {
- println("shake : " + force);
- }
- public void accelerationEvent(float x, float y) {
- // println("acceleration: " + x + ", " + y + ", " + z);
- ax = x;
- ay = y;
- redraw();
- }
- //For Compass
- void pauseCompass() {
- if (compass != null) compass.pauseCompass();
- }
- void resumeCompass() {
- if (compass != null) compass.resumeCompass();
- }
- void directionEvent(float newDirection) {
- direction = newDirection;
- }
- class MapMovement {
- int x, y;
- float speed;
- MapMovement(int xx, int yy, float sp){
- x = xx;
- y = yy;
- speed = sp;
- }
- void update(){
- image(map, x, y, width, height);
- x -= ax*speed;
- y += ay*speed;
- }
- }
1