mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
refined dude and item
This commit is contained in:
parent
2df41336f4
commit
3f418a1b25
2 changed files with 6 additions and 6 deletions
|
|
@ -51,8 +51,8 @@ function setupWorld(gravity) {
|
||||||
// create some objects
|
// create some objects
|
||||||
|
|
||||||
|
|
||||||
dude = makeBody(.2, .6, 2, 12, true).GetBody();
|
dude = makeBody(.2, .6, 2, 12, true, 3).GetBody();
|
||||||
item = makeBody(.3, .1, 1.7, 11, false).GetBody();
|
item = makeBody(.2, .2, 1.8, 11.5, false, 1).GetBody();
|
||||||
|
|
||||||
|
|
||||||
var jointDef = new b2RevoluteJointDef();
|
var jointDef = new b2RevoluteJointDef();
|
||||||
|
|
@ -72,10 +72,10 @@ function setupWorld(gravity) {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeBody(width, height, x, y, fixedRotation){
|
function makeBody(width, height, x, y, fixedRotation, mass){
|
||||||
|
|
||||||
var fixDef = new b2FixtureDef;
|
var fixDef = new b2FixtureDef;
|
||||||
fixDef.density = 1.0;
|
fixDef.density = mass;
|
||||||
fixDef.friction = 0.99;
|
fixDef.friction = 0.99;
|
||||||
fixDef.restitution = .51;
|
fixDef.restitution = .51;
|
||||||
fixDef.shape = new b2PolygonShape;
|
fixDef.shape = new b2PolygonShape;
|
||||||
|
|
@ -92,5 +92,5 @@ function makeBody(width, height, x, y, fixedRotation){
|
||||||
|
|
||||||
function jump(body) {
|
function jump(body) {
|
||||||
body.SetAwake(true);
|
body.SetAwake(true);
|
||||||
body.ApplyImpulse(new b2Vec2(1, -1), body.GetPosition());
|
body.ApplyImpulse(new b2Vec2(2, -3), body.GetPosition());
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>join demo</title>
|
<title>How to Join</title>
|
||||||
<script src="box2d.js"></script>
|
<script src="box2d.js"></script>
|
||||||
<script src="common.js"></script>
|
<script src="common.js"></script>
|
||||||
<script src="client.js"></script>
|
<script src="client.js"></script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue