Thanks for the feedback! ;-)
52 2014-01-09 07:04:30
Re: my project for the competition (30 replies, posted in Showcase)
Thank you! I am Very pleased..
53 2014-01-08 14:00:26
Topic: my project for the competition (30 replies, posted in Showcase)
hi all! develop since the beginning of January on Maratis Engine. video:
old - http://youtu.be/OsxMX9rbryk
new - http://youtu.be/vOrpkTKV1K8
P.S. This is not a full game, but it is quite suitable as the basis for the game.
54 2014-01-05 09:41:49
Re: semitransparent object (2 replies, posted in General)
thank you, Vegas! it works!
55 2014-01-05 08:52:30
Topic: semitransparent object (2 replies, posted in General)
is it possible to do? I have tried to do an alpha channel, but failed.
56 2013-12-29 05:57:29
Re: Test projects (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.
57 2013-12-06 08:05:33
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
finish! I spawned about 200 clones and all works well!
And I made a small optimization in the code, now Spawnpoints.lua looks shorter.
testarea.7z
58 2013-12-06 03:08:13
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
Hi Vegas!
I could upload a test project if u wish
Yes, it will be easier for us to deal with it.
59 2013-12-05 02:57:28
Re: TD Levels (with downloads) (42 replies, posted in Showcase)
great job!
St Petersburg
60 2013-12-01 01:36:04
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
thanks Tutorial Doctor!
61 2013-11-30 14:53:50
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
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.
62 2013-11-30 10:36:37
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
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
63 2013-11-30 10:19:33
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
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
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
64 2013-11-29 15:43:47
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
if you have shown your .lua file, I would try to understand it
65 2013-11-29 02:01:34
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
wow it feel weird, that's also my name
unexpectedly...
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
66 2013-11-28 13:48:52
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
Hi, Vegas! actually it is very simple
-- 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.
67 2013-11-25 07:38:36
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
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
68 2013-11-25 06:49:34
Re: Object Oriented Programming in Maratis(LUA)(Tutorial) (29 replies, posted in Tutorials/Examples)
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 2013-10-17 03:42:30
Re: Functions request (36 replies, posted in Scripting)
So I do. But it's not comfortable.
70 2013-10-16 03:38:26
Re: Functions request (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 2013-10-16 03:26:45
Re: TD Levels (with downloads) (42 replies, posted in Showcase)
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