Fixed a few bugs.

This commit is contained in:
Nick Winter 2014-09-01 16:14:50 -07:00
parent 195e027b53
commit 72eb59b7c3
5 changed files with 13 additions and 9 deletions

View file

@ -136,7 +136,8 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
width = @thang.width * Camera.PPM
height = @thang.height * Camera.PPM * @options.camera.y2x
depth = @thang.depth * Camera.PPM * @options.camera.z2y * @options.camera.y2x
makeColor = (brightnessFactor) => (Math.round(c * brightnessFactor) for c in (healthColors[@thang.team] ? [180, 180, 180]))
brightnessFuzzFactor = 1 + 0.1 * (Math.random() - 0.5)
makeColor = (brightnessFactor) => (Math.round(c * brightnessFuzzFactor * brightnessFactor) for c in (healthColors[@thang.team] ? [180, 180, 180]))
topColor = "rgba(#{makeColor(0.85).join(', ')},1)"
mainColor = "rgba(#{makeColor(0.75).join(', ')},1)"
ellipse = @thang.shape in ['ellipsoid', 'disc']

View file

@ -428,15 +428,18 @@ module.exports = Surface = class Surface extends CocoClass
pageHeight = $('#page-container').height() - $('#control-bar-view').outerHeight() - $('#playback-view').outerHeight()
newWidth = Math.min pageWidth, pageHeight * aspectRatio
newHeight = newWidth / aspectRatio
else if $('#editor-level-thangs-tab-view')
newWidth = $('#canvas-wrapper').width()
newHeight = newWidth / aspectRatio
else
newWidth = 0.55 * pageWidth
newHeight = newWidth / aspectRatio
@canvas.width newWidth
@canvas.height newHeight
return unless newWidth > 0 and newHeight > 0
#if InstallTrigger? # Firefox rendering performance goes down as canvas size goes up
# newWidth = Math.min 924, newWidth
# newHeight = Math.min 589, newHeight
##if InstallTrigger? # Firefox rendering performance goes down as canvas size goes up
## newWidth = Math.min 924, newWidth
## newHeight = Math.min 589, newHeight
#@canvas.width newWidth
#@canvas.height newHeight
@canvas.attr width: newWidth, height: newHeight
@stage.scaleX *= newWidth / oldWidth
@stage.scaleY *= newHeight / oldHeight

View file

@ -199,6 +199,7 @@ module.exports = class WizardSprite extends IndieSprite
wizard.beginMoveTween()
endMoveTween: =>
return if @destroyed
@thang.action = if @editing then 'cast' else 'idle'
@thang.actionActivated = @thang.action is 'cast'
@reachedTarget = true

View file

@ -1,7 +1,7 @@
c = require './../schemas'
ThangComponentSchema = require './thang_component'
ThangTypeSchema = c.object()
ThangTypeSchema = c.object default: {kind: 'Misc'}
c.extendNamedProperties ThangTypeSchema # name first
ShapeObjectSchema = c.object {title: 'Shape'},

View file

@ -318,7 +318,6 @@ module.exports = class ThangsTabView extends CocoView
physicalConfig = {pos: {x: 10, y: 10, z: 1}}
if physicalOriginal = _.find(defaultComponents ? [], original: componentOriginals['physics.Physical'])
physicalConfig.pos.z = physicalOriginal.config?.pos?.z ? 1 # Get the z right
console.log physicalOriginal, defaultComponents, componentOriginals['physics.Physical'], physicalConfig
[
{original: componentOriginals['existence.Exists'], majorVersion: 0, config: {}}
{original: componentOriginals['physics.Physical'], majorVersion: 0, config: physicalConfig}