Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // components
- function Component_CharacterPhysics( pos )
- {
- this.position = clone( pos );
- // ...
- }
- function Component_CharacterPhysics_Tick( delta )
- {
- this.position.y += delta;
- // ...
- }
- function Component_Sprite( texture )
- {
- this.sprite = MakeSprite( texture );
- }
- function Component_Sprite_Draw()
- {
- if( @this.sprite )
- DrawSprite( this.sprite );
- }
- // entities
- function Entity_Player( params )
- {
- Player =
- {
- };
- Player!Component_CharacterPhysics( params.position );
- Player!Component_Sprite( "textures/player.png" );
- function Player.tick( delta )
- {
- this!Component_CharacterPhysics_Tick( delta );
- }
- function Player.draw()
- {
- this!Component_Sprite_Draw();
- }
- return Player;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement