51

(30 replies, posted in Showcase)

Thanks for the feedback! ;-)

52

(30 replies, posted in Showcase)

Thank you! I am Very pleased..

53

(30 replies, posted in Showcase)

hi all! develop since the beginning of January on Maratis Engine. wink video: 
old -  http://youtu.be/OsxMX9rbryk 
new - http://youtu.be/vOrpkTKV1K8   


download:
Game.exe Project  

P.S. This is not a full game, but it is quite suitable as the basis for the game.

54

(2 replies, posted in General)

thank you, Vegas! it works! smile

55

(2 replies, posted in General)

is it possible to do? I have tried to do an alpha channel, but failed.

56

(25 replies, posted in Showcase)

there is no game made on a Maratis, because the engine is not enough basic things (in lua)... many times I started the game on Maratis, but everytime i had to leave to another engine.

finish! I spawned about 200 clones and all works well!
And I made a small optimization in the code, now Spawnpoints.lua looks shorter. wink
testarea.7z

Hi Vegas!

I could upload a test project if u wish

Yes, it will be easier for us to deal with it. smile

59

(42 replies, posted in Showcase)

great job!
St Petersburg big_smile

thanks Tutorial Doctor! wink

I am glad I could help...
by the way, I made a typo in the previous example.
in Apple:create(name, color) instead::

app.color = red

you need to:

app.color = color

fixed that.

I hope this will help you understand:

Apple = {}
function Apple:create(name, color)
    local app = {}
    app.color = color 
    app.name = name
    app.mass = 10
    
    setmetatable(app,self)
    self.__index = self
    return app
end

appleList = {}

-- CREATE INSTANCE
appleList[1] = Apple:create("apple1", "red")
appleList[2] = Apple:create("apple2", "green")

-- PROFIT!
print ("name="..appleList[1].name.." color="..appleList[1].color.." mass="..appleList[1].mass) 
-- RESULT          name=apple1 color=red mass=10

print ("name="..appleList[2].name.." color="..appleList[2].color.." mass="..appleList[2].mass) 
-- RESULT          name=apple2 color=green mass=10

You need to check collision appleList and bullet?
if Yes, then you need to do so
in the class bullet:

  function ball:update()    
        translate(self.object, {-0.5, 0, 0}, "local") 
    
        for i=1,#appleList do -- iterating through all instances appleList class Apple.
            if isCollisionBetween(self.object, appleList[i].object) then 
               deactivate(self.object)
            end   
        end         
  end

here's the entire code. Just in case wink

Apple = {}
count = 1  -- counter appleLists
function Apple:create(x,y,z)

    local app = {}
    app.object = getClone(getObject("Apple"))
    app.x = x; app.y = y; app.z = z
    setPosition(app.object,{app.x,app.y,app.z})
    
    function app:update()
        
    end

    count = count+1
    
    setmetatable(app,self)
    self.__index = self
    return app

end

appleList = {}

    --[[                    CLASS2            ]]
PlayerBullet = {}
k = 1  -- counter bullets
function PlayerBullet:create(x,y,z)

    local ball = {}
    ball.object = getClone(getObject("PlayerBullet"))
    ball.x = x; ball.y = y; ball.z = z
    setPosition(ball.object,{ball.x,ball.y,ball.z})
    
    function ball:update()
    
        translate(self.object, {-0.5, 0, 0}, "local") 
    for i=1, #appleList do
        if isCollisionBetween(self.object, appleList[i].object) then 
            deactivate(self.object)
        end    
    end
        
    end

    k = k+1
    
    setmetatable(ball,self)
    self.__index = self
    return ball

end

bullet = {}

    --[[                    SCENE UPDATE            ]]
function onSceneUpdate()

    --********** update a clone **********
    for i =1, #bullet do bullet[i]:update() end 
    for i =1, #appleList do appleList[i]:update() end 
    
    --************* create a clone: ***************
    if onKeyDown("SPACE") then
        bullet[k] = PlayerBullet:create(0,0,0)
        appleList[count] = Apple:create(-20,0,0)
    end 

end

if you have shown your .lua file, I would try to understand it smile

Vegas wrote:

wow it feel weird, that's also my name

unexpectedly... big_smile

I would do this:

PlayerBullet = {}
k = 1  -- counter bullets
function PlayerBullet:create(x,y,z)

    local ball = {}
    ball.object = getClone(getObject("PlayerBullet"))
    ball.x = x; ball.y = y; ball.z = z
    setPosition(ball.object,{ball.x,ball.y,ball.z})
    
    function ball:update()
        if isCollisionBetween(self.object, EndWall) then 
            deactivate(self.object)
        end    
    end

    k = k+1
    
    setmetatable(ball,self)
    self.__index = self
    return ball

end

bullet = {}

Then in onSceneUpdate :

function onSceneUpdate()

    --************* create a clone: ***************
    if isKeyPressed("SPACE") then
        bullet[k] = PlayerBullet:create(0,0,0)
    end 
    
    --********** update a clone **********
    for i =1, #bullet do
        bullet[i]:update
    end 

end

Hi, Vegas! actually it is very simple smile

-- CREATE CLASS 1
apple_class1 = {}
function apple_class1:new(x,y,z)
    local o = {}
    o.mesh = getClone(getObject("apple"))
    o.x = x; o.y = y; o.z = z
    setPosition(o.mesh,{o.x,o.y,o.z})

    setmetatable(o,self)
    self.__index = self
    return o
end
-- create an instance of the class 1.
apple = apple_class1:new(1,0,1)

-- CREATE CLASS 2
apple_class2 = {}
function apple_class2:new(x,y,z)
    local o = {}
    o.mesh = getClone(getObject("apple2"))
    o.x = x; o.y = y; o.z = z
    setPosition(o.mesh,{o.x,o.y,o.z})
    
    function o:update()
        --**************** COLLISIONS! ******************************
        if isCollisionBetween(apple.mesh,self.mesh) then -- apple.mesh -> apple = apple_class1:new(1,0,1)
            print("COLLIDED!")
        end
    end
    
    setmetatable(o,self)
    self.__index = self
    return o
end
-- create an instance of the class 2.
apple2 = apple_class2:new(10,0,1)

--UPDATE
function onSceneUpdate()

    apple2:update() -- apple_class2 -> function o:update()

end

if you have questions, ask. I will be glad to help.

here's how you can make a class with methods.

base = {}
function base:new(x,y,z)
   local obj = {}
   obj.x = x or 0
   obj.y = y or 0
   obj.z = z or 0
   
   function obj:get()
      return self.x, self,y, self,z
   end

   self.__index = self
   return obj
end

object = base:new(10,10,10)
print (object:get()) -- result 10,10,10

I made the example classes of lua. I hope someone will come in handy.
Classes, inheritance, and polymorphism.

--init class car

class_car = {}

function class_car:new(model, color)
    local object = {}
    object.model = model or "Nissan" --by default, Nissan
    object.color = color or "Red" -- by default, red

    setmetatable(object,self)
    self.__index = self
    return object
end

--create a car
my_auto = class_car:new("BMW",nil) --> we obtain: BMW Red

--create methods
function class_car:set(color)
    self.color = color
end

function class_car:get()
    return self.model, self.color
end

-- change the color of the car.
my_auto:set("BLACK")

--check:
print(my_auto:get()) --> BMW BLACK

--################## Inheritance ##############

class_moto = {} -- init class moto

--overriding a method (polymorphism)
function class_moto:get()
    return "2000", "year"
end

--inherit.
setmetatable(class_moto,{__index = class_car})

--create an instance of the class moto.
my_moto = class_moto:new()

my_moto:set("BLUE")

print(my_moto:get()) --> 2000 year (A call to a method on the child.)
print(class_car.get(my_moto))    --> Nissan BLUE (Call the parent method.)

69

(36 replies, posted in Scripting)

So I do. But it's not comfortable.

70

(36 replies, posted in Scripting)

Add already function spawn! Is it so difficult??? Something like these:
spawnEntity("file path") or loadMesh("file path")
Pleeeease!

71

(42 replies, posted in Showcase)

Tutorial Doctor wrote:

I have been trying to create a script that lets me toggle through characters.

I did it for you! ;-)
Press TAB to switch between characters.
2_Jules.7zip

72

(42 replies, posted in Showcase)

http://youtu.be/hTrSvHpLkME

73

(42 replies, posted in Showcase)

Tutorial Doctor, HI!
I have changed your lua script for Jules N' Funland. Used object oriented features, lua. I hope you enjoy it smile
http://savepic.su/3451502m.jpg

Jules.lua