mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-22 10:55:19 -04:00
Picked some slightly less awful particle colors for different terrains and level types. Enabled for half the players.
This commit is contained in:
parent
92f070ecca
commit
fd0e7a8c44
4 changed files with 172 additions and 57 deletions
app
assets/images/common/particles
core
models
views/play
Binary file not shown.
Before ![]() (image error) Size: 7.8 KiB After ![]() (image error) Size: 5.5 KiB ![]() ![]() |
|
@ -1,4 +1,5 @@
|
|||
CocoClass = require 'core/CocoClass'
|
||||
utils = require 'core/utils'
|
||||
|
||||
module.exports = ParticleMan = class ParticleMan extends CocoClass
|
||||
|
||||
|
@ -32,13 +33,11 @@ module.exports = ParticleMan = class ParticleMan extends CocoClass
|
|||
100 * 0.5, # Right
|
||||
100 * 0.5 * @aspectRatio, # Top
|
||||
100 * -0.5 * @aspectRatio, # Bottom
|
||||
0, # Near
|
||||
1000 # Far
|
||||
0, # Near frustrum distance
|
||||
1000 # Far frustrum distance
|
||||
)
|
||||
@camera.position.set(0, 0, 100)
|
||||
#@camera.position.set(0, 0, 0)
|
||||
#@camera.lookAt particleGroup.mesh.position
|
||||
@camera.up = new THREE.Vector3(0, 1, 0) # this might help? http://stackoverflow.com/questions/14271672/moving-the-camera-lookat-and-rotations-in-three-js
|
||||
@camera.up = new THREE.Vector3(0, 1, 0) # http://stackoverflow.com/questions/14271672/moving-the-camera-lookat-and-rotations-in-three-js
|
||||
@camera.lookAt new THREE.Vector3(0, 0, 0)
|
||||
unless @started
|
||||
@started = true
|
||||
|
@ -70,8 +69,9 @@ module.exports = ParticleMan = class ParticleMan extends CocoClass
|
|||
@framesRendered = 0
|
||||
@lastFPS = now
|
||||
|
||||
addEmitter: (x, y, kind="star-fountain") ->
|
||||
addEmitter: (x, y, kind="level-dungeon-premium") ->
|
||||
return if @unsupported
|
||||
console.log 'adding kind', kind
|
||||
options = $.extend true, {}, particleKinds[kind]
|
||||
options.group.texture = THREE.ImageUtils.loadTexture "/images/common/particles/#{options.group.texture}.png"
|
||||
scale = 100
|
||||
|
@ -104,53 +104,153 @@ module.exports = ParticleMan = class ParticleMan extends CocoClass
|
|||
#@scene.add light
|
||||
|
||||
|
||||
hsl = (hue, saturation, lightness) ->
|
||||
new THREE.Color utils.hslToHex([hue, saturation, lightness])
|
||||
vec = (x, y, z) ->
|
||||
new THREE.Vector3 x, y, z
|
||||
|
||||
defaults =
|
||||
group:
|
||||
texture: 'star'
|
||||
maxAge: 4
|
||||
hasPerspective: 1
|
||||
colorize: 1
|
||||
transparent: 1
|
||||
alphaTest: 0.5
|
||||
depthWrite: false
|
||||
depthTest: true
|
||||
blending: THREE.NormalBlending
|
||||
emitter:
|
||||
type: "cube"
|
||||
particleCount: 60
|
||||
position: vec 0, 0, 0
|
||||
positionSpread: vec 1, 0, 1
|
||||
acceleration: vec 0, -1, 0
|
||||
accelerationSpread: vec 0, 0, 0
|
||||
velocity: vec 0, 4, 0
|
||||
velocitySpread: vec 2, 2, 2
|
||||
sizeStart: 6
|
||||
sizeStartSpread: 0
|
||||
sizeMiddle: 4
|
||||
sizeMiddleSpread: 0
|
||||
sizeEnd: 2
|
||||
sizeEndSpread: 0
|
||||
angleStart: 0
|
||||
angleStartSpread: 0
|
||||
angleMiddle: 0
|
||||
angleMiddleSpread: 0
|
||||
angleEnd: 0
|
||||
angleEndSpread: 0
|
||||
angleAlignVelocity: false
|
||||
colorStart: hsl 0.55, 0.75, 0.75
|
||||
colorStartSpread: vec 0.3, 0.3, 0.3
|
||||
colorMiddle: hsl 0.55, 0.6, 0.5
|
||||
colorMiddleSpread: vec 0.2, 0.2, 0.2
|
||||
colorEnd: hsl 0.55, 0.5, 0.25
|
||||
colorEndSpread: vec 0.1, 0.1, 0.1
|
||||
opacityStart: 1
|
||||
opacityStartSpread: 0
|
||||
opacityMiddle: 0.75
|
||||
opacityMiddleSpread: 0
|
||||
opacityEnd: 0.25
|
||||
opacityEndSpread: 0
|
||||
duration: null
|
||||
alive: 1
|
||||
isStatic: 0
|
||||
|
||||
ext = (d, options) ->
|
||||
$.extend true, {}, d, options ? {}
|
||||
|
||||
particleKinds =
|
||||
'star-fountain':
|
||||
group:
|
||||
texture: 'star'
|
||||
maxAge: 4
|
||||
hasPerspective: 1
|
||||
colorize: 1
|
||||
transparent: 1
|
||||
alphaTest: 0.5
|
||||
depthWrite: false
|
||||
depthTest: true
|
||||
blending: THREE.NormalBlending
|
||||
'level-dungeon-premium': ext defaults
|
||||
'level-forest-premium': ext defaults,
|
||||
emitter:
|
||||
type: "cube"
|
||||
particleCount: 60
|
||||
position: new THREE.Vector3(0, 0, 0)
|
||||
#positionSpread: new THREE.Vector3(2, 2, 0)
|
||||
positionSpread: new THREE.Vector3(1, 0, 1)
|
||||
acceleration: new THREE.Vector3(0, -1, 0)
|
||||
accelerationSpread: new THREE.Vector3(0, 0, 0)
|
||||
velocity: new THREE.Vector3(0, 4, 0)
|
||||
velocitySpread: new THREE.Vector3(2, 2, 2)
|
||||
sizeStart: 8
|
||||
sizeStartSpread: 0
|
||||
sizeMiddle: 4
|
||||
sizeMiddleSpread: 0
|
||||
sizeEnd: 1
|
||||
sizeEndSpread: 0
|
||||
angleStart: 0
|
||||
angleStartSpread: 0
|
||||
angleMiddle: 0
|
||||
angleMiddleSpread: 0
|
||||
angleEnd: 0
|
||||
angleEndSpread: 0
|
||||
angleAlignVelocity: false
|
||||
colorStart: new THREE.Color(0xb9c5ff)
|
||||
colorStartSpread: new THREE.Vector3(0, 0, 0)
|
||||
colorMiddle: new THREE.Color(0x535eff)
|
||||
colorMiddleSpread: new THREE.Vector3(0, 0, 0)
|
||||
colorEnd: new THREE.Color(0x0000c4)
|
||||
colorEndSpread: new THREE.Vector3(0, 0, 0)
|
||||
opacityStart: 1
|
||||
opacityStartSpread: 0
|
||||
opacityMiddle: 0.5
|
||||
opacityMiddleSpread: 0
|
||||
opacityEnd: 0
|
||||
opacityEndSpread: 0
|
||||
duration: null
|
||||
alive: 1
|
||||
isStatic: 0
|
||||
colorStart: hsl 0.56, 0.97, 0.5
|
||||
colorMiddle: hsl 0.56, 0.57, 0.5
|
||||
colorEnd: hsl 0.56, 0.17, 0.5
|
||||
'level-desert-premium': ext defaults,
|
||||
emitter:
|
||||
colorStart: hsl 0.56, 0.97, 0.5
|
||||
colorMiddle: hsl 0.56, 0.57, 0.5
|
||||
colorEnd: hsl 0.56, 0.17, 0.5
|
||||
'level-mountain-premium': ext defaults,
|
||||
emitter:
|
||||
colorStart: hsl 0.56, 0.97, 0.5
|
||||
colorMiddle: hsl 0.56, 0.57, 0.5
|
||||
colorEnd: hsl 0.56, 0.17, 0.5
|
||||
|
||||
particleKinds['level-dungeon-gate'] = ext particleKinds['level-dungeon-premium'],
|
||||
emitter:
|
||||
particleCount: 120
|
||||
velocity: vec 0, 6, 0
|
||||
colorStart: hsl 0.5, 0.75, 0.9
|
||||
colorMiddle: hsl 0.5, 0.75, 0.7
|
||||
colorEnd: hsl 0.5, 0.75, 0.3
|
||||
colorStartSpread: vec 1, 1, 1
|
||||
colorMiddleSpread: vec 1.5, 1.5, 1.5
|
||||
colorEndSpread: vec 2.5, 2.5, 2.5
|
||||
|
||||
particleKinds['level-dungeon-hero-ladder'] = ext particleKinds['level-dungeon-premium'],
|
||||
emitter:
|
||||
particleCount: 90
|
||||
velocity: vec 0, 4, 0
|
||||
colorStart: hsl 0, 0.75, 0.7
|
||||
colorMiddle: hsl 0, 0.75, 0.5
|
||||
colorEnd: hsl 0, 0.75, 0.3
|
||||
|
||||
particleKinds['level-forest-gate'] = ext particleKinds['level-forest-premium'],
|
||||
emitter:
|
||||
particleCount: 120
|
||||
velocity: vec 0, 8, 0
|
||||
colorStart: hsl 0.56, 0.97, 0.3
|
||||
colorMiddle: hsl 0.56, 0.57, 0.3
|
||||
colorEnd: hsl 0.56, 0.17, 0.3
|
||||
colorStartSpread: vec 1, 1, 1
|
||||
colorMiddleSpread: vec 1.5, 1.5, 1.5
|
||||
colorEndSpread: vec 2.5, 2.5, 2.5
|
||||
|
||||
particleKinds['level-forest-hero-ladder'] = ext particleKinds['level-forest-premium'],
|
||||
emitter:
|
||||
particleCount: 90
|
||||
velocity: vec 0, 4, 0
|
||||
colorStart: hsl 0, 0.95, 0.3
|
||||
colorMiddle: hsl 0, 1, 0.5
|
||||
colorEnd: hsl 0, 0.75, 0.1
|
||||
|
||||
particleKinds['level-desert-gate'] = ext particleKinds['level-desert-premium'],
|
||||
emitter:
|
||||
particleCount: 120
|
||||
velocity: vec 0, 8, 0
|
||||
colorStart: hsl 0.56, 0.97, 0.3
|
||||
colorMiddle: hsl 0.56, 0.57, 0.3
|
||||
colorEnd: hsl 0.56, 0.17, 0.3
|
||||
colorStartSpread: vec 1, 1, 1
|
||||
colorMiddleSpread: vec 1.5, 1.5, 1.5
|
||||
colorEndSpread: vec 2.5, 2.5, 2.5
|
||||
|
||||
particleKinds['level-desert-hero-ladder'] = ext particleKinds['level-desert-premium'],
|
||||
emitter:
|
||||
particleCount: 90
|
||||
velocity: vec 0, 4, 0
|
||||
colorStart: hsl 0, 0.95, 0.3
|
||||
colorMiddle: hsl 0, 1, 0.5
|
||||
colorEnd: hsl 0, 0.75, 0.1
|
||||
|
||||
particleKinds['level-dungeon-gate'] = ext particleKinds['level-dungeon-premium'],
|
||||
emitter:
|
||||
particleCount: 120
|
||||
velocity: vec 0, 8, 0
|
||||
colorStart: hsl 0.56, 0.97, 0.3
|
||||
colorMiddle: hsl 0.56, 0.57, 0.3
|
||||
colorEnd: hsl 0.56, 0.17, 0.3
|
||||
colorStartSpread: vec 1, 1, 1
|
||||
colorMiddleSpread: vec 1.5, 1.5, 1.5
|
||||
colorEndSpread: vec 2.5, 2.5, 2.5
|
||||
|
||||
particleKinds['level-dungeon-hero-ladder'] = ext particleKinds['level-dungeon-premium'],
|
||||
emitter:
|
||||
particleCount: 90
|
||||
velocity: vec 0, 4, 0
|
||||
colorStart: hsl 0, 0.95, 0.3
|
||||
colorMiddle: hsl 0, 1, 0.5
|
||||
colorEnd: hsl 0, 0.75, 0.1
|
||||
|
|
|
@ -123,6 +123,16 @@ module.exports = class User extends CocoModel
|
|||
application.tracker.identify gemPromptGroup: @gemPromptGroup unless me.isAdmin()
|
||||
@gemPromptGroup
|
||||
|
||||
getForeshadowsLevels: ->
|
||||
return @foreshadowsLevels if @foreshadowsLevels?
|
||||
group = me.get('testGroupNumber') % 16
|
||||
@foreshadowsLevels = switch group
|
||||
when 0, 1, 2, 3, 4, 5, 6, 7 then true
|
||||
when 8, 9, 10, 11, 12, 13, 14, 15 then false
|
||||
@foreshadowsLevels = true if me.isAdmin()
|
||||
application.tracker.identify foreshadowsLevels: @foreshadowsLevels unless me.isAdmin()
|
||||
@foreshadowsLevels
|
||||
|
||||
getVideoTutorialStylesIndex: (numVideos=0)->
|
||||
# A/B Testing video tutorial styles
|
||||
# Not a constant number of videos available (e.g. could be 0, 1, 3, or 4 currently)
|
||||
|
|
|
@ -257,12 +257,17 @@ module.exports = class CampaignView extends RootView
|
|||
@playAmbientSound()
|
||||
|
||||
testParticles: ->
|
||||
return unless me.isAdmin()
|
||||
return unless @campaign.loaded and me.getForeshadowsLevels()
|
||||
@particleMan ?= new ParticleMan()
|
||||
@particleMan.removeEmitters()
|
||||
@particleMan.attach @$el.find('.map')
|
||||
for levelID, level of @campaign.renderedLevels ? {} when level.hidden
|
||||
@particleMan.addEmitter level.position.x / 100, level.position.y / 100
|
||||
for level in @campaign.renderedLevels ? {} when level.hidden
|
||||
particleKey = ['level', @terrain]
|
||||
particleKey.push level.type if level.type and level.type isnt 'hero'
|
||||
particleKey.push 'premium' if level.requiresSubscription
|
||||
particleKey.push 'gate' if level.slug in ['kithgard-gates', 'siege-of-stonehold', 'clash-of-clones']
|
||||
continue if particleKey.length is 2 # Don't show basic levels
|
||||
@particleMan.addEmitter level.position.x / 100, level.position.y / 100, particleKey.join('-')
|
||||
|
||||
onSessionsLoaded: (e) ->
|
||||
return if @editorMode
|
||||
|
|
Loading…
Reference in a new issue