Jump to content

Genebris

Members
  • Posts

    517
  • Joined

  • Last visited

Posts posted by Genebris

  1. Well, I guess you have to add variable in all your scripts that will be true when the game is on pause. For example in enemy script you should check this variable each update and move enemy only if it's false. There is no automatic way to stop time for all entities and scripts.

    Or you can stop calling World:Update? Maybe it's a proper way.

  2. I remember I had to only add like two lines into drawimage shader and then through the scrip I could send this shader a parameter to cut this image by 50% when I have 50% health. But I guess after update this shader was replaced and I can't find it now. Just do what macklebee told in this thread.

  3. I was looping through all entities in the world each update in my map script and didn't notice any fps drops, so I think it's good enough.

    Something like this:

    
    

    for i=0,App.world:CountEntities()-1 do

    local entity = App.world:GetEntity(i)

    if entity:GetKeyValue("name") == "Crate" then

    --this is your crate entity, can count it or delete

    end

    end

    Strange that CountEntities and GetEntity aren't in documentation, they are very important.

    • Upvote 2
  4. You can us calculate normals function in Leadwerks model editor, it's described here: http://www.leadwerks.com/werkspace/page/documentation/_/user-guide/model-editor-r16

    If you want to make your normals in Blender you can use Edge split modifier. It has angle option (the same as leadwerks) and you also can mark some edges as sharp manually: select edges, press Ctrl+e, then select "mark sharp". Then you won't need to correct normals in Leadwerks.

  5. One more thing. If you want to save a list of different points into a file you can make it like this:

     

    first points=12

    second points=25

    another points=72

     

    And then when you read the files to get points you can find equal sign and split string by it. Use default Lua functions like this one for that: http://www.lua.org/manual/5.3/manual.html#pdf-string.sub

    It will be like this: you open a file, read a first string, get this value: "first points=12". Then you loop through all symbols in the string looking for "=" and take everything after it. And it will be your first points value.

    I do it like this for stats of weapons stored in a file.

  6. I think global values won't be deleted when you change the level as they are not tied to any entity in the world. So what I wrote should work across levels. If you want to store points between game launches, then you can write it to a file. Do you want that?

  7. I thought that same model file can never have different materials. They are always instances.

    No, sorry. Now I see they are always instanced only in the editor.

  8. Make a table and write your items in it like this:

    self.inventory[#self.inventory+1]={}
    self.inventory[#self.inventory].name="Sword"
    self.inventory[#self.inventory].amount=3
    

    This will add 3 swords into your inventory. Then in PostRender you check if inventory menu is opened, and if it is you loop through inventory and draw items icons:

    for i=1, #self.inventory do
    context:DrawImage(Texture:Load("folderWithIcons/"..self.inventory[i].name), 100, 100+i*50)
    context:DrawText(self.inventory[i].amount, 120, 100+i*50)
    end
    

  9. I think that it's related to the problem that I had few times before. I think that sometimes things just don't get saved. Even if you press save 10 times and launch the game several times (which also should save the map), it can be that something isn't saved on the map. It can be properties in script settings or objects placed on the map. I'm not sure, but I THINK that that happened to me few times beofre. And I also had to delete an object and make it again. And it seems like you have just got the same problem.

    Sadly I don't know how to reproduce this and I can't corfirm that it's not just my imagination.

×
×
  • Create New...