Liam Pierce
My feedback
1 result found
-
377 votesLiam Pierce supported this idea ·
An error occurred while saving the comment An error occurred while saving the comment Liam Pierce commentedhero = stamp('dragon11down',120)
boss = stamp('fairy',90,90,100)
cave = stamp('',0)
score = 0
keys = 0
speed = 0
walkSpeed = 10
facing = DOWN
zapStamp = 'fireball'buttonPushed = false
defeatedBoss = false
hasGoldKey = falseheroes = {}
heroes[UP] = 'dragon11up'
heroes[DOWN] = 'dragon11down'
heroes[RIGHT] = 'dragon11right'
heroes[LEFT] = 'dragon11left'things = []
function resetRoom() {
things.length = 0newX = hero.x
newY = hero.y
if (newX > 550 || newX < 220) {
newX = 384 + (384 - newX)
} else if (newY > 770 || newY < 220) {
newY = 512 + (512 - newY)
}
reset()
hero = stamp('dragon11down',newX,newY,120)
controller = stamp('controller2',390,960)
stamp('flare',5000).size(0,500)
}function touching() {
if (x < 190 && y > 830) {
if (x < 80) { facing = LEFT }
if (x > 130) { facing = RIGHT }
if (y < 910) { facing = UP }
if (y > 950) { facing = DOWN }
speed = walkSpeed
}
if (hero.hits(boss)) {
boss.pop()
defeatedBoss = false
}
}function untouch() {
speed = 0
}function tap() {
if (x > 620 && y > 880) {
z = stamp(zapStamp,hero.x,hero.y,50)
z.rotate(facing)
z.move(UP,1000,2000)
}
}function activate(thing) {
zaps = thing.hits(zapStamp)
if (zaps.length) {
zap = zaps[0]
zap.hide()
stamp('pow',zap.x,zap.y)
if (thing.getsZapped != undefined) {
thing.getsZapped()
}
}
if (thing.moveAround != undefined) {
thing.moveAround()
}
if (thing.hits(hero)) {
if (thing.waitingForFirstHit != true) {
} else if (thing.currentlyHitsHero != true) {
thing.currentlyHitsHero = true
if (thing.hitsHero != undefined) {
thing.hitsHero()
}
}
} else {
thing.waitingForFirstHit = true
thing.currentlyHitsHero = false
}
}function stayInRoom() {
newX = Math.max(160,hero.x)
newX = Math.min(610,newX)
newY = Math.max(160,hero.y)
newY = Math.min(820,newY)
hero.move(newX,newY)
}function loop() {
hero.change(heroes[facing])
hero.move(facing,speed)
stayInRoom()
hero.front()
controller.front()
things.forEach(activate)
if (cave.hits('dragon11right')) {
cavern()
}
if (cave.hits('dragon11left')) {
cavern()
}
if (cave.hits('dragon11up')) {
cavern()
}
if (cave.hits('dragon11down')) {
cavern()
}
if (score == 1) {
hero.move(660,500,500)
delay(hider,500)
}
}function loadLobby() {
resetRoom()
fill('dungeon')
doorNorth = stamp('door3',380,100,100)
doorWest = stamp('door3',100,500,100,270)
doorEast = stamp('door2',670,500,100,90)
doorNorth.hitsHero = loadCrownRoom
doorEast.hitsHero = checkForGoldKey
doorWest.hitsHero = loadKeyRoom
things.push(doorNorth,doorEast,doorWest)
}
loadLobby()function checkForGoldKey() {
if (hasGoldKey == true) {
loadButtonRoom()
} else {
hero.move(WEST,20)
}
}function loadKeyRoom() {
resetRoom()
fill('brick room')
exit = stamp('door3',670,500,100,90)
exit.hitsHero = loadLobby
friend = stamp('pixie',390,250,175)
friend.hitsHero = giveAdvice
key = stamp('key2',384,800,100)
key.hitsHero = getGoldKey
key.hide()
things.push(exit,friend,key)
}function giveAdvice() {
text('Defeating the boss drains pools!',380,100,CENTER,'white')
friend.pop()
key.unhide()
sound('heart')
}function getGoldKey() {
sound('coin')
hasGoldKey = true
key.pop()
}function loadButtonRoom() {
resetRoom()
fill('log cabin')
exit = stamp('door3',100,500,100,270)
exit.hitsHero = loadLobby
cave = stamp('block36',500,500,100)
cave.hitsHero = cavern
cave.rotate(999999,999999)
button = stamp('button3',550,220,100)
button.hitsHero = pushButton
things.push(exit,button)
}function pushButton() {
button.change('button4')
sound('terminal')
text('BOSS DOOR OPENED!',100,100,50,('white'))
buttonPushed = true
boss.move(100,500,100)
}function loadCrownRoom() {
resetRoom()
fill('pool3')exitDown = stamp('door3',380,920,100,180)
exitDown.hitsHero = loadLobby
exitRight = stamp('door2',670,500,100,90)
//other half is
exitUp = stamp('door6',380,100,300)
exitUp.hitsHero = checkForButton
pool = stamp('waterpool',250)
pool.hitsHero = touchPool
if (defeatedBoss == true) {
pool.size(0,2000)
}
prize = stamp('crown7',150)
prize.hitsHero = getPrize
things.push(exitUp,exitDown,pool,prize)
}
function touchPool() {
hero.hide()
stamp('splash',382,600,100)
text('YOU DROWNED',306,620,50,('red'))
}
function getPrize() {
touching = null
tap = null
touch = null
sound('coin')
text('YOU WIN!',100,CENTER)
prize.move(660,500,500)
score = score + 1
exitRight.change('door3')
}
function checkForButton() {
if (buttonPushed == true) {
loadEvilFairyRoom()
} else {
hero.move(DOWN,20)
}
}
function loadEvilFairyRoom() {
resetRoom()
fill('freezer')
exit = stamp('door3',380,920,100,180)
exit.hitsHero = loadCrownRoom
boss = stamp('evil fairy',400,150,145)
boss.hitsHero = eatHero
boss.getsZapped = hurtBoss
boss.moveAround = randomFlight
things.push(exit,boss)
}
function randomFlight() {
this.move(UP,15)
this.wrap()
this.rotate(RIGHT,random(-15,15))
}
function eatHero() {
tap = null
stamp('gameover',375,350)
text('Eaten by a fairy.',CENTER,'red')
stamp('pop',hero.x,hero.y)
sound('bite')
hero.hide()
}
function hurtBoss() {
boss.hide()
defeatedBoss = true
stamp('pop',this.x,this.y,300)
sound('dino11')
}
function cavern() {
text('Burnt To A Crisp!',306,510,50,('red'))
hero.hide()
}
function hider() {
prize.hide()
hero.hide()
}