Jump to content

codeape

Members
  • Posts

    183
  • Joined

  • Last visited

Posts posted by codeape

  1. I got it to work now =)

     

    function Script:Start()
       --Player movement speed
       self.moveSpeed = 0.2
       -- Camera distance from player
       self.camDist = 10
       -- Create camera and position it
       local camPos = self.entity:GetPosition(true)
       self.cam = Camera:Create()
       camPos.y = self.camDist
       self.cam:Move(camPos)
       self.cam:SetRotation(90,0,0)
    end
    function Script:UpdatePhysics()
       local window = Window:GetCurrent()
       local context = Context:GetCurrent()
       -- Player keyboard input
       local xMod = 0;
       if window:KeyDown(Key.D) then
           xMod = 1 * Time:GetSpeed() * self.moveSpeed
       elseif window:KeyDown(Key.A) then
           xMod = -1 * Time:GetSpeed() * self.moveSpeed
       end
       local zMod = 0
       if window:KeyDown(Key.W) then
           zMod = 1 * Time:GetSpeed() * self.moveSpeed
       elseif window:KeyDown(Key.S) then
           zMod = -1 * Time:GetSpeed() * self.moveSpeed
       end
       -- Move player
       local curr = self.entity:GetPosition(true)
       curr.x = curr.x + xMod
       curr.z = curr.z + zMod
       self.entity:SetPosition(curr, true)
       -- Move camera
       curr.y = self.camDist
       self.cam:SetPosition(curr, true)
    end
    

     

    I did some other changes. Like not creating my player Entity (a box) in code (for now). And I changed the physics mode to "Character Controller" (the Collition type is "Character" also but I do not think that maters for the problems I had).

     

    I also moved all code from App.lua to it's own script that is attached to the player Entity.

  2. Thanks Aggror and cassius

     

    Tried PhysicsSetPosition() and added physics type Entity.RigidBodyPhysics and mass 1. Now it works but the movement is not very smoth like when I used SetPosition. I need to trim this biggrin.png

  3. Hello

     

    I like Leadwerks biggrin.png ... and have a lot fun with it ... however

     

    I am playing around with the Steam Leadwerks (Lua) and try to make a simple "top down shooter". I have watched some tutorials and I thought I did this right.

     

    I create my player (currently a cone) like this:

     

    --Player
    self.coneMat = Material:Load("Materials/Developer/greengrid.mat")
    self.cone = Model:Cone()
    self.cone:SetMaterial(self.coneMat)
    self.cone:SetPosition(0,1.75,0)
    self.cone:SetRotation(90,0,0)
    local shape = Shape:Cone(0,0,0, 0,0,0, 1,1,1)
    self.cone:SetShape(shape)
    
    --Player movement speed
    self.moveSpeed = 0.1
    

     

     

    I have created a floor and 4 walls in the editor and the walls have "Physics mode : Rigid Body" and a shape size that corresponds to the wall size (used the "Fit Shape" button in the Physics tab).

     

    The player movement code looks like this:

    -- Player movement
    local xMod = 0;
    if self.window:KeyDown(Key.D) then
       xMod = 1 * Time:GetSpeed() * self.moveSpeed
    elseif self.window:KeyDown(Key.A) then
       xMod = -1 * Time:GetSpeed() * self.moveSpeed
    end
    
    local zMod = 0
    if self.window:KeyDown(Key.W) then
       zMod = 1 * Time:GetSpeed() * self.moveSpeed
    elseif self.window:KeyDown(Key.S) then
       zMod = -1 * Time:GetSpeed() * self.moveSpeed
    end
    
    local curr = self.cone:GetPosition(true)
    curr.x = curr.x + xMod
    curr.z = curr.z + zMod
    self.cone:SetPosition(curr, true)
    
    curr = self.cam:GetPosition(true)
    curr.x = curr.x + xMod
    curr.z = curr.z + zMod
    self.cam:SetPosition(curr, true)
    

     

    The cone go through the walls. What am I doing wrong?

  4. Thank you, but the big challenge is to use the standard system icons when possible, and use icons designed to fit the same theme when there is not a standard system icon for the item. I mean, I doubt Ubuntu has a standard "rotate the selected object around the Y axis" icon.

     

    Ahhhha ok ph34r.png

  5. The exact numbers will depend on your hardware, but it's very efficient at rendering instanced geometry like that. 10,000 on camera might be too many, but with distance and frustum culling that could definitely be done.

     

    Cool, that was exactly the answer I was looking for smile.png

  6. Hello

     

    Grate update cool.png

     

    Reading the update got me very exited. Could the mentioned "uniform buffers for hardware skinning and instanced rendering" be used to create huge astroid fields consisting of for example 10000 or more asteroids using 10 different models with almost no performance penalties. Am I right?

  7. I found this at SlashDot:

    http://games.slashdot.org/story/13/11/19/206209/2-d-mmog-glitch-released-completely-into-the-public-domain

     

    Glitch, a collaborative, web-based, massively multiplayer game developed by Tiny Speck, Inc. (tinyspeck.com) has been released under the Creative Commons CC0 1.0 Universal License. I'm not at all familiar with this game, but it is rare that both source code and all game assets are released into the public domain, which makes this announcement noteworthy. An excerpt from the announcement: 'The entire library of art assets from the game has been made freely available, dedicated to the public domain. Code from the game client is included to help developers work with the assets. All of it can be downloaded and used by anyone, for any purpose. (But: use it for good.)

     

    Ok it is a 2D game but there must be stuff that can be reused in this package of 10.000+ assets like sounds and music etc.

×
×
  • Create New...