Skip to content

unitpoint/os2d

Repository files navigation

OS2D is cross platform engine for 2d mobile games

OS2D is cross platform engine for 2d mobile games made with ObjectScript and Oxygine.

OS2D is cross platform engine for 2d games

Build and run

Windows

Open and run examples\Demo\proj.win32\Demo_vs2010.sln. Please see more examples.

Android

Run examples\Demo\proj.android\build-run.bat

Getting Started

The main ObjectScript file is Demo\data\main.os of Demo example.

Examples of ObjectScript code:

// create sprite and display it
var sprite = Sprite()
sprite.resAnim = res.getResAnim("anim")
sprite.parent = stage
sprite.scale = 0.5

// run opacity and position tween using one action (see SeqTween example)
sprite.addTweenAction {
	duration = 1.0, // in seconds
	opacity = 0.5,
	pos = vec2(100, 120),
	ease = Ease.BACK_IN_OUT // ease type, it's linear by default
}

// run forever rotate action (see SeqTween example)
// rotate sprite in 2 seconds and repeat it forever
myAction = sprite.addAction(RepeatForeverAction(TweenAction{
	duration = 2, 
	angle = 360,
	name = "rotate-action"
}))

// remove action
sprite.removeAction(myAction)

// remove actions by name
sprite.removeActionsByName("rotate-action")
	
// handle event
sprite.addEventListener(TouchEvent.CLICK, function(ev){  
	// your code here
})

// handle user event
sprite.addEventListener("hide", function(ev){  
	// your code here
})

// dispatch user event
sprite.dispatchEvent{"hide", prop1 = "prop1", prop2 = 100}

// short syntax of initialization
// you could use any properties you want
sprite = Sprite().attrs {
	resAnim = res.getResAnim("plus"),
	scale = 0.5f,
	pos = vec2(70, 55),
	parent = stage,
}

// Actor is base class that could be rendered
// use it as group of actors, sprites and so on
actor = Actor().attachTo(stage)

// add update function that will be called each 0.3 seconds
// (see AngryMonsters examle)
myUpdate = actor.addUpdate(0.3, function(){
	// your code here
})

// remove update function
actor.removeUpdate(myUpdate)

// add update function of each frame
actor.addUpdate(function(){
	// your code here
})

// add timeout function to call in 2.5 seconds
// (see DemoFloor example)
actor.addTimeout(2.5, function(){
	// your code here
})

Examples

CastleMonster

Opensource CastleMonster example made with OS2D

SeqTween

Opensource SeqTween example made with OS2D

DemoFloor

Opensource DemoFloor example made with OS2D, level 2

AngryMonsters

Opensource AngryMonsters example made with OS2D

Demo

Opensource Demo example made with OS2D

ElasticTransition

Opensource ElasticTransition example made with OS2D

eXeXeXeX

Opensource eXeXeXeX example made with OS2D

Resources

##Contacts

Please feel free to contact me at anytime, my email is evgeniy.golovin@unitpoint.ru, skype: egolovin

About

OS2D is ObjectScript engine for 2d games

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages