Permissions are set so anyone (with a GitHub account) can edit. I get notified of each and every edits everyone does.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu// room script file
World* world;
Overlay* ov;
struct Physical {
Body* body;
Shape* shape;
Fixture* fixture;
};
Physical ground;
Physical ball;
function room_Load()
{
if(world == null){
AgsBox2D.SetMeter(32.0);
world = AgsBox2D.CreateWorld(0.0, 9.8*AgsBox2D.GetMeter());
ground.body = AgsBox2D.CreateBody(world, 160.0, 160.0, eBodyStatic);
ground.shape = AgsBox2D.CreateRectangleShape(320.0, 40.0);
ground.fixture = AgsBox2D.CreateFixture(ground.body, ground.shape);
ball.body = AgsBox2D.CreateBody(world, 160.0, 40.0, eBodyDynamic);
ball.shape = AgsBox2D.CreateCircleShape(20.0);
ball.fixture = AgsBox2D.CreateFixture(ball.body, ball.shape, 1.0);
ball.fixture.Restitution = 0.5;
AgsBox2D.CreateFixture(AgsBox2D.CreateBody(world, 80.0, 60.0, eBodyDynamic),
AgsBox2D.CreateRectangleShape(30.0, 20.0), 5.0);
}
}
function room_RepExec()
{
if(IsKeyPressed(eKeyLeftArrow)) ball.body.ApplyForce(-500.0, 0.0);
if(IsKeyPressed(eKeyRightArrow)) ball.body.ApplyForce(500.0, 0.0);
if(IsKeyPressed(eKeyUpArrow) && ball.body.IsTouching(ground.body)){
ball.body.ApplyForce(0.0, -6000.0);
ball.body.SetLinearVelocity(0.0, 0.0);
}
if(ov!=null && ov.Valid) ov.Remove();
ov = Overlay.CreateGraphical(0, 0, world.GetDebugSprite(), true);
world.Step(1.0/IntToFloat(GetGameSpeed()), 8, 3);
}
~/git/ags/
~/git/agsbox2d/
void DealWithAnObject(Object* obj) {
// Do something with obj
}
import void DealWithAnObject(Object* obj);
// called on every game cycle, except when the game is blocked
function repeatedly_execute()
{
Controlz(player,
IsKeyPressed(eKeyDownArrow),
IsKeyPressed(eKeyLeftArrow),
IsKeyPressed(eKeyRightArrow),
IsKeyPressed(eKeyUpArrow));
Controlz(cEgo2,
IsKeyPressed(eKeyS), IsKeyPressed(eKeyA),
IsKeyPressed(eKeyD), IsKeyPressed(eKeyW));
}
function repeatedly_execute()
{
Controlz(player,
IsKeyPressed(eKeyDownArrow) || IsKeyPressed(eKeyS),
IsKeyPressed(eKeyLeftArrow) || IsKeyPressed(eKeyA),
IsKeyPressed(eKeyRightArrow) || IsKeyPressed(eKeyD),
IsKeyPressed(eKeyUpArrow) || IsKeyPressed(eKeyW));
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.169 seconds with 15 queries.