Commit 48a0949a authored by Tomi Korpipää's avatar Tomi Korpipää

Clean up TennisGame behavior scripts

parent 06ac6833
...@@ -30,9 +30,9 @@ Behavior { ...@@ -30,9 +30,9 @@ Behavior {
property var speed property var speed
//Properties used as global variables //Properties used as global variables
property var mouseDown: false property bool mouseDown: false
property var input: Qt.vector3d(0, 0, 0); property vector3d input: Qt.vector3d(0, 0, 0);
property var direction: Qt.vector3d(-1, Math.random() * 2 - 1, 0); property vector3d direction: Qt.vector3d(-1, Math.random() * 2 - 1, 0);
property var physicsSpeed property var physicsSpeed
property var serveTimer: 1 property var serveTimer: 1
...@@ -148,8 +148,7 @@ Behavior { ...@@ -148,8 +148,7 @@ Behavior {
if (canMoveY) { if (canMoveY) {
setAttribute("position.y", next.y); setAttribute("position.y", next.y);
} } else {
else {
if (hasPhysics) if (hasPhysics)
fireEvent("ballCollision"); fireEvent("ballCollision");
direction.y = -direction.y; direction.y = -direction.y;
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
import QtStudio3D.Behavior 1.0 import QtStudio3D.Behavior 1.0
Behavior { Behavior {
property var playerScore: 0 property int playerScore: 0
property var computerScore: 0 property int computerScore: 0
property var isplayerScore: false property bool isplayerScore: false
onUpdate: { onUpdate: {
if(isplayerScore === true) if (isplayerScore === true)
setAttribute("textstring", playerScore.toFixed()); setAttribute("textstring", playerScore.toFixed());
else else
setAttribute("textstring", computerScore.toFixed()); setAttribute("textstring", computerScore.toFixed());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment