Forums

OverviewFelgo 2 Support (Qt 5) › syntax error

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16303

    Patricia

    Hi, when I run the program it send me an error, but I cant know where is the problem , because the line it say me doesnt exist. This is my file:

    import Felgo 3.0

    import QtQuick 2.0
    import QtMultimedia 5.0
    import QtQml 2.2
    import ".."
    import "../sound"
    
    
    Level {
      levelName: "Level1"
    
    
    
    
      EntityManager{
          id:entityManager
          entityContainer: sceneWindow
      }
    
    
    
    
          Timer {
              id:move
    
    
              interval: 10
              repeat: true
              running: false
              triggeredOnStart: true
    //definición de las variables tita, velocidad inicial y gravedad
              property double tita: 0
    
    
              property double g: 3
    
    
    //cuando choca contra las paredes rebota con una velocidad de signo contrario
    
    
              onTriggered:{
    
    
    
    
    
    
                  if(bird.x > 1000)
                      bird.vx = -bird.vx*0.80;
    //                    bird.x = bird.x - bird.width
                  if (bird.y >= 750)
    //
                      bird.vy = -bird.vy*0.80;
    //                    bird.y = bird.y-bird.height
                  if(bird.x < 0)
    
    
                      bird.vx = -bird.vx*0.80;
                  if(bird.y< 0)
                      bird.vy = -bird.vy*0.80;
    //                    bird.y = bird.y + bird.height
    
    
                  if(bird.vy <= 1 && bird.vy>=-1 && bird.y >= 768){
                      lifes.lifesNumber--
                       move.stop()
    
    
                  }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    //                if(bird.x + bird.width > box.x && bird.y+ bird.height> box.y)
    
    
    //                    bird.x = box.x - bird.width
    
    
    
    
    
    
    
    
    
    
    //movimiento del pollito con un tiro parabólico
                    bird.vy = bird.vy - (g/2)
                      bird.x= bird.x +(bird.vx)
                      bird.y= bird.y -(bird.vy)
    
    
    
    
    
    
    
    
              }
    
    
          }
    
    
    
    
    
    
    
    
    
    
    
    
    //fondo del juego
      Background{
      id: background
      height: 768
      width: 1024
      }
    
    
    //posición y velocidad inicial del pollito.
      Bird{
      id: bird
      x: 100
      y: 550
      z: 1
      property int vi: 0
      property double vx: bird.vi*Math.cos(move.tita)
      property double vy: bird.vi*Math.sin(-move.tita)
      Timer {
          id: birdPosition
    
    
          interval: 100
          repeat: true
          running: true
          onTriggered:{
              console.log(bird.vx, bird.vy,bird.x, bird.y)
              if(move.running == false && bird.y >= 768){
                 bird.x = 100
                 bird.y = 550
                 bird.vx = 0
                 bird.vy = 0
              }
          }
      }
    
    
    
    
          Behavior on x{ //el tiempo que va a tardar en moverse en cada iteracción en el eje x
              NumberAnimation{
              duration: 10
    
    
    
    
              }
          }
    
    
          Behavior on y{ //el tiempo que va a tardar en moverse en cada iteracción en el eje y
              NumberAnimation{
                  duration:10
              }
          }
    
    
      }
    
    
      MyBox{
          id:box
          x:924
          y:660
    
    
    
    
      }
    
    
      MyBox{
          id:box1
          x:824
          y:660
      }
    
    
      MyBox{
          id: box2
          x:924
          y:560
      }
    
    
      Coin{
          id: coin
          x: 900
          y: 500
      }
    
    
    
    
      Coin{
          id: coin1
          x: 860
          y: 550
      }
    
    
    
    
    //posición del velocimetro
      Speedometer{
          id: speedometer
          x:-100
          y:620
      }
    
    
      Wall {
          id: border_bottom
    
    
          height: 20
          anchors {
              left: parent.left
              right: parent.right
              bottom: parent.bottom
          }
      }
    
    
      Wall {
          id: border_top
    
    
          height: 20
          anchors {
              top: parent.top
              left: parent.left
              right: parent.right
          }
      }
    
    
      Wall {
          id: border_left
          width: 20
          anchors {
              top: parent.top
              bottom: parent.bottom
              left: parent.left
          }
      }
    
    
      Wall {
          id: border_right
          width: 20
          anchors {
              top: parent.top
              bottom: parent.bottom
              right: parent.right
          }
      }
    
    
    
    
      Needle{ //definición de las características de la flecha del indicador de velocidad
          id: needle
          x:-100
          y:620
          property alias needle_angle: rotation1.angle
    
    
         transform: Rotation{
              id: rotation1
    
    
               origin.x: 125; origin.y: 125
    
    
               RotationAnimation on angle { //rotación desde 0 a -90 grados
                   id: counterclockwise
                   from: 0
                   to: -90
                   running: false
                   duration: 2000
                   direction: RotationAnimation.Counterclockwise
                   loops: Animation.Infinite
               }
    
    
               RotationAnimation on angle{ //rotación desde los -90 hasta los 0 grados
                   id:clockwise
                   from: -90
                   to: 0
                   running: false
                   duration: 2000
                   direction: RotationAnimation.Clockwise
                   loops: Animation.Infinite
    
    
               }
          }
    
    
    
    
    
    
                 Timer{ //la rotación de la aguja en cada diracción va a tardar 2 segundos
                     id:moveNeedle
                     interval: 2000
                     repeat: true
                     running: true
                     property bool titaNeedle: false
    
    
                     onTriggered: { //cambio de sentido (al contrario de las agujas del reloj)
                         if(titaNeedle == false){
                            counterclockwise.running = true
                             titaNeedle = true
                             clockwise.running = false
    
    
    
    
                         }else{ //cambio de sentido (en el sentido de las agujas del reloj)
                          titaNeedle = false
                             clockwise.running = true
                             counterclockwise.running = false
    
    
                         }
                     }
                  }
         }
    
    
    
    
    
    
      Bar{
          id:bar
          x: 150
          y: 660
      }
    
    
      BarBlue{
          id: barBlue
          x:145
          y:745
    
    
          NumberAnimation on y{
              id: upBar
              from: 745
              to: 645
              running: false
              duration: 1000
    
    
    
    
          }
    
    
          NumberAnimation on y{
              id: downBar
              from: 645
              to: 745
              running: false
              duration: 1000
    
    
          }
    
    
          Timer{
              id:moveBar
              interval: 1
              repeat: true
              running: false
              property double velocity: 0
    
    
              onTriggered: {
                  if(barBlue.y == 745){
                     downBar.running = false
                     upBar.running = true
                     velocity = barBlue.y - 745
    
    
    
    
    
    
                  }else if(barBlue.y == 645){
    
    
                      upBar.running = false
                      downBar.running = true
                      velocity = 645 - barBlue.y
    
    
    
    
                  }
    
    
    
    
              }
    
    
           }
    
    
    
    
    
    
      }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    //definición de la acción que se va a realizar cuando se pulse el ratón.Se define la acción que se va a realizar en cada estado.
    
    
      Rectangle {
              anchors.fill: parent
              id: button1
              state: "firstState"
              color: "transparent"
    
    
              //process mouseArea onClicked ==> in first state
              function processFirstState()
              {
                  //will be called on first onClick processing
                  button1.state = "secondState"
                  console.log("i am in first state , and i am going to second state")
                  console.log (needle.needle_angle);
                              move.tita = (Math.PI*needle.needle_angle)/180
    
    
                              counterclockwise.stop()
                              clockwise.stop()
                              moveNeedle.running = false
                             moveBar.running = true
              }
    
    
              //process MouseArea onclicked ==> in second state
              function processSecondState()
              {
                  //will be called on second onClick processing
                  button1.state = "firstState"
                  console.log("i am in second state , and i am going to first one")
                  bird.vi = (745 - barBlue.y)/2
                              moveBar.running = false
    
    
                             move.restart()
                             moveNeedle.running = true
                             console.log(bird.vi)
    
    
              }
    
    
    
    
              MouseArea {
                  id: button1area
                  anchors.fill: parent
                  onClicked:
                  {
                      // Here , you can call the function you want depending on your state
                      button1.state === "firstState" ?
                                  button1.processFirstState() : button1.processSecondState()
    
    
    
    
                  }
              }
    
    
          }
    
    
      PhysicsWorld {
          id: world
          opacity: 0
          updatesPerSecondForPhysics: 60
          gravity.y: 9.8
    
    
    
    
      }
    
    
      ScoreBoards{
          id:scoreBoard
          x: 1024/2
          y: 0
    
    
          Text{
              text: number.score
              font.pointSize: 40
              color: "white"
              font.bold: true
    
    
              anchors.horizontalCenter: scoreBoard.horizontalCenter
              y: scoreBoard.height/2.5
    
    
          }
    
    
      }
    
    
      ScoreNumber{
          id:number
      }
    
    
      Heart{
         id: heart
         y:0
         x: 1024/4
    
    
         Text{
             text: lifes.lifesNumber
             font.pointSize: 40
             color: "red"
             font.bold: true
    
    
             anchors.right: heart.left
    
    
    
    
    
    
         }
      }
    
    
      LifesNumber{
          id: lifes
      }
    
    
    
    
    //botón posicionado arriba y a la izquierda para poder salir de pantalla completa
    
    
     AudioManager{
        id:audioManager
    
    
    }
    
    
     BackgroundMusic{
          id: backgroundMusic
          source: "sound/backgroundAudio.wav"
          autoPlay: true
          loops: Audio.Infinite
          volume:0.1
      }
      //poder mutear el sonido de fondo
      AudioButton{
          id:audioButton
          anchors.top: window.top
          anchors.right: window.right
          state: "stopState"
          function stopMusic(){
              audioButton.state = "playState"
              backgroundMusic.stop()
              console.log("stopState")
              opacity= 0.5
          }
          function playMusic(){
              audioButton.state = "stopState"
              backgroundMusic.play()
              console.log("playState")
              opacity = 1
          }
          onClicked: {
              audioButton.state === "stopState" ?
                          audioButton.stopMusic() : audioButton.playMusic()
          }
      }
    }
    and the error:
    qrc:/levels/Level1.qml:951:1: Syntax error
    
    I hope you can help me!
    thank you!
    
    
    
    #16304

    Patricia

    I solved it. I had missed:

    Scene{

      id: sceneWindow
      visible: true
      width: 768
      height: 1024
      }
    
    now, it works!
Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support