Navigation Menu

Skip to content

Commit

Permalink
minor callibrations
Browse files Browse the repository at this point in the history
still buggy:
  sometimes naubs joined throu joints but not through joins
  sometimes naubs just disappear
  investigate!
  • Loading branch information
hoodie committed May 9, 2012
1 parent 7cc7a70 commit d546085
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions coffee/Game.coffee
Expand Up @@ -113,7 +113,7 @@ define ["Layer", "Naub", "Graph", "Shapes", "CollisionHandler"], (Layer, Naub, G
naub.kind = 'ball'

@add_object naub
naub.add_shape new NumberShape
#naub.add_shape new NumberShape
#naub.update() # again just to get the numbers
naub

Expand All @@ -135,7 +135,7 @@ define ["Layer", "Naub", "Graph", "Shapes", "CollisionHandler"], (Layer, Naub, G
naub.kind = 'box'

@add_object naub
naub.add_shape new NumberShape
#naub.add_shape new NumberShape
#naub.update() # again just to get the numbers
naub

Expand Down
6 changes: 4 additions & 2 deletions coffee/Naub.coffee
Expand Up @@ -186,8 +186,10 @@ define -> class Naub
# do things a naub is supposed to do
join_with: (other) ->
#restLength, stiffness, damping
joint = new cp.DampedSpring( @physical_body, other.physical_body, cp.vzero, cp.vzero, @radius*2, 5, 5)
joint2 = new cp.SlideJoint( @physical_body, other.physical_body, cp.vzero, cp.vzero, @radius*2.5, @radius*4.5)
minlen = Naubino.settings.naub.min_join_len * @size
maxlen = Naubino.settings.naub.max_join_len * @size
joint = new cp.DampedSpring( @physical_body, other.physical_body, cp.vzero, cp.vzero, minlen, 10, 4)
joint2 = new cp.SlideJoint( @physical_body, other.physical_body, cp.vzero, cp.vzero, minlen, maxlen)

@layer.space.addConstraint( joint )
@layer.space.addConstraint( joint2 )
Expand Down
6 changes: 3 additions & 3 deletions coffee/Naubino.coffee
Expand Up @@ -16,7 +16,7 @@ define ["Background", "Game", "Keybindings", "Menu", "Overlay", "StandardGame",
constructor: () ->
console.log "Naubino Constructor"

@name = "Naubino"
@name = "Naubino (chipmunk branch)"
@settings = Settings
@colors = @settings.colors.output
@create_fsm()
Expand Down Expand Up @@ -56,8 +56,8 @@ define ["Background", "Game", "Keybindings", "Menu", "Overlay", "StandardGame",
@game_standard = new StandardGame(@game_canvas)
@game_testcase = new TestCase(@game_canvas)
@game_tutorial = new Tutorial(@game_canvas)
#@game = @game_standard
@game = @game_testcase
@game = @game_standard
#@game = @game_testcase
#@game = @game_tutorial
#@menu = new Menu(@menu_canvas)
@overlay = new Overlay(@overlay_canvas)
Expand Down
12 changes: 7 additions & 5 deletions coffee/Settings.coffee
Expand Up @@ -9,24 +9,26 @@ define -> Settings = {

game:
creation_offset: 50
min_joining_force: 300
min_joining_force: 100

naub:
size: 28
mass: 1
mass: 5
friction: 0.5
elasticity: .8
elasticity: 1
min_join_len: 1.2 # times size
max_join_len: 2 # times size

physics:
center_join:
restLength: 0
stiffness: 2
damping: 12
damping: 5
fps: 35 # bug: slows down if high cpu usage
calming_const: 0.5
join_length: 3.0 # margin between joined naubs (n* avg size)
spring_force: 0.6
damping: 0.4
damping: 0.3

canvas:
scale: 1 # not yet implemented
Expand Down
6 changes: 3 additions & 3 deletions coffee/StandardGame.coffee
Expand Up @@ -24,13 +24,13 @@ define ["Game"], (Game) -> class StandardGame extends Game
@basket_size = @default_basket_size = 160
@spammers = @default_spammers = {
pair:
method: => @create_naub_pair(null, null, @max_color(), @max_color() )
method: => @create_naub_pair(null, @max_color(), @max_color() )
probability: 5
mixed_pair:
method: => @create_naub_pair(null, null, @max_color(), @max_color(), true )
method: => @create_naub_pair(null, @max_color(), @max_color(), true )
probability: 0
triple:
method: => @create_naub_triple(null, null, @max_color(), @max_color(), @max_color() )
method: => @create_naub_triple(null, @max_color(), @max_color(), @max_color() )
probability: 0
}

Expand Down

0 comments on commit d546085

Please sign in to comment.