/Placebo-Engine

Placebo - Python library on create games or other applications

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Placebo-Engine

Placebo - Python library on create games or other applications

Import Game Engine

from placebo.engine import init, Engine

using:

init()
myGame = Engine("My first game", 1200, 720)

myGame.start()

Using Scenes:

import class:

from placebo.engine import init, Engine, Scene

create new scene nameScene = Scene(sceneName)

mainScene = Scene('main')

add scene to engine:

myGame.add(mainScene)

go to scene:

myGame.goTo('main') # go to other scene

Using Objects

import class:

from placebo.engine import init, Engine, Scene, Object

create new object objectName = Object(objectName)

firstObject = Object('firstObject')

add object to scene:

mainScene.add(firstObject)

Usign Components

import class:

from placebo.engine import init, Engine, Scene, Object, Component

create personal component:

class MyFirstComponent(Component):
  # this method run only once
  def init(self, object, scene, engine):
    print("Component '%s' initialed!", % self.name)

  # this method run only one game cycle
  def update(self, object, scene, engie):
    print("'%s' → is runned!", % self.name)
    
myFirstComponent = MyFirstComponent('firstComponent')

add component into object:

firstObject.add(myFirstComponent)