https://linen.dev logo
Join Discord
Powered by
# ceramic
  • g

    gifted-whale-78169

    12/16/2022, 1:34 AM
    two more questions about physics- is the arcade physics system only for the javascript target? also, which is better for physics in general(collisions, gravity, etc.), nape or arcade?
  • g

    gifted-whale-78169

    12/16/2022, 1:40 AM
    oh well since arcade is a port i guess its all targets, i thought it was just a binding
  • b

    billowy-waiter-28954

    12/16/2022, 10:41 AM
    @gifted-whale-78169 yes, it’s cross platform, not specific to js (it even works in unity!)
  • b

    billowy-waiter-28954

    12/16/2022, 10:45 AM
    Regarding nape vs arcade, arcade is much lighter footprint but you can only do aabb collisions. That said it’s enough for many games and the way to go if you don’t need complicated physics. It also adds several arcade/physics related methods to the Visual type. Nape is more advanced but a bit less well integrated with ceramic visuals, use it if you have a use case that arcade physics don’t solve
  • g

    gifted-whale-78169

    12/16/2022, 11:10 AM
    cool, thanks!
  • g

    gifted-whale-78169

    12/16/2022, 7:37 PM
    im trying to add collisions to my code with arcade:
    Copy code
    hx
            initPhysics();
        }
        function initPhysics() {
            app.arcade.onUpdate(this, updatePhysics);
        }
        function updatePhysics(d: Float) {
            trace(plr);
            trace(block);
            plr.updatePhysics([block]); //!get collisions working
        }
    but i keep getting an error for the
    onUpdate
    event, saying
    TypeError: Cannot read property 'enable' of null
  • g

    gifted-whale-78169

    12/16/2022, 7:37 PM
    how can i fix it?
  • g

    gifted-whale-78169

    12/16/2022, 7:37 PM
    im trying to base it off of the pixel platformer physics but i cant get it to work
  • b

    billowy-waiter-28954

    12/16/2022, 7:46 PM
    Can’t say why it doesn’t work with just a snippet like this
  • g

    gifted-whale-78169

    12/16/2022, 7:51 PM
    alright let me share some more
  • g

    gifted-whale-78169

    12/16/2022, 7:51 PM
    Copy code
    hx
    //player
        public function updatePhysics(a:Array<arcade.Collidable>) {
            for (v in a) {
                app.arcade.world.collide(this, v);
            }
  • g

    gifted-whale-78169

    12/16/2022, 7:52 PM
    Copy code
    hx
    //scene
        override function create() {
            app.arcade.world.gravityY = -90;
    
            block = initBlock("Hellope, worl!");
            add(block);
            
            plr = new Player();
            plr.depth = 1;
            plr.anchor(0.5, 0.5);
            plr.pos(width/2, height - 65);
            add(plr);
    
            var hint = initHint("I hate", "mice");
            add(hint);
    
            app.arcade.onUpdate(this, updatePhysics);
        }
        function updatePhysics(d: Float) {
            plr.updatePhysics([block]);
        }
  • g

    gifted-whale-78169

    12/16/2022, 7:53 PM
    it looks like it has something to do with the arcade init with the
    block
  • b

    billowy-waiter-28954

    12/16/2022, 7:54 PM
    If you don’t manage to solve the problem, you can send me a full ceramic project reproducing the issue and I’ll take a look (well, not right now because I’m sick but soon)
  • g

    gifted-whale-78169

    12/16/2022, 7:55 PM
    Copy code
    hx
        function initBlock(t:String): Visual {
                    //begin block and children definition//
            block = new Visual();
            block.depth = 0; //lets player be shown in front
            block.pos(width/2, height/2);
    
            var q = new Quad();
            q.size(200, 200);
            q.color = Color.WHITE;
            q.anchor(0.5, 0.5);
            q.initArcadePhysics();
            q.body.immovable = true;
            q.body.allowGravity = false;
            block.add(q);
    
            var txt = new Text();
            txt.align = CENTER;
            txt.color = Color.BLACK;
            txt.content = t;
            txt.anchor(0.5, 0.5);
            txt.pointSize = 30;
            txt.color = Color.CRIMSON;
            txt.clip = q; //makes text clip if out of q bounds
            block.add(txt);
    is the block, i forgot to change the updatePhysics to
    plr.updatePhysics([block.children[0]]);
  • g

    gifted-whale-78169

    12/16/2022, 7:55 PM
    alright i will
  • g

    gifted-whale-78169

    12/16/2022, 7:55 PM
    and feel better :)
  • e

    elegant-twilight-61392

    12/16/2022, 7:58 PM
    what file does it say this is in?
  • g

    gifted-whale-78169

    12/16/2022, 7:59 PM
    in the scene file
  • g

    gifted-whale-78169

    12/16/2022, 7:59 PM
    same as this
  • g

    gifted-whale-78169

    12/16/2022, 8:00 PM
    just showed more
  • e

    elegant-twilight-61392

    12/16/2022, 8:01 PM
    thats what file the error shows?
  • g

    gifted-whale-78169

    12/16/2022, 8:01 PM
    the scene, the error is in the
    arcade.onUpdate
    event
  • g

    gifted-whale-78169

    12/16/2022, 8:01 PM
    oh wait i think i solved it
  • g

    gifted-whale-78169

    12/16/2022, 8:02 PM
    i was attempting to collide with
    block
    when it doesnt have the physics initialized
  • g

    gifted-whale-78169

    12/16/2022, 8:02 PM
    now i need to get it to also not hit
    q
    , but im not sure how to do that
  • g

    gifted-whale-78169

    12/16/2022, 8:02 PM
    i guess i could just make it a global variable
  • f

    fierce-tiger-85769

    12/16/2022, 8:03 PM
    I really like Haxe and am struggling a bit choosing the best game engine for my needs. Why would I choose ceramic over say heaps?
  • e

    elegant-twilight-61392

    12/16/2022, 8:03 PM
    im pretty sure heaps is much lower level than ceramic
  • g

    gifted-whale-78169

    12/16/2022, 8:03 PM
    i find it more high-level and just generally easier to use
1...303132...124Latest