Platformer with Level Editor
import QtQuick 2.0
import Felgo 3.0
import "../editorElements"
PlatformerEntityBaseDraggable {
id: opponent
entityType: "opponent"
property int startX
property int startY
property bool alive: true
property bool hidden: false
z: 1
width: image.width
height: image.height
image.visible: !hidden
onEntityCreated: updateStartPosition()
onEntityReleased: updateStartPosition()
Timer {
id: hideTimer
interval: 2000
onTriggered: hidden = true
}
function updateStartPosition()
{
startX = x
startY = y
}
function reset_super()
{
alive = true
hideTimer.stop()
hidden = false
x = startX
y = startY
collider.linearVelocity.x = 0
collider.linearVelocity.y = 0
collider.force = Qt.point(0, 0)
}
function die() {
alive = false
hideTimer.start()
if(variationType == "walker")
audioManager.playSound("opponentWalkerDie")
else if(variationType == "jumper")
audioManager.playSound("opponentJumperDie")