Skip to content

Instantly share code, notes, and snippets.

@Sephi-Chan
Created July 11, 2011 10:54
Show Gist options
  • Save Sephi-Chan/1075675 to your computer and use it in GitHub Desktop.
Save Sephi-Chan/1075675 to your computer and use it in GitHub Desktop.
ig
.module('game.entities.levelchange')
.requires('impact.entity')
.defines ->
window.EntityLevelchange = ig.Entity.extend
_wmDrawBox: true
_wmBoxColor: 'rgba(0, 0, 255, 0.7)'
size:
x: 8
y: 8
level: null # Name of the level where the player is sent.
door: null # Name of the door in the targetted level.
triggeredBy: (entity, trigger)->
# Change the current level.
level = ig.global["Level#{@level}"]
ig.game.loadLevelDeferred(level)
console.log level
# Retrieve the door location, which is the "ChangeLevel" entity.
# This entity name follow the pattern Level_Door.
name = "#{@level}_#{@door}"
door = ig.game.getEntityByName(name)
console.log door
# Pop the player on the level and move it aside the door.
# ....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment