diff --git a/android/assets/commons.json b/android/assets/commons.json index f36648b..ceacd74 100644 --- a/android/assets/commons.json +++ b/android/assets/commons.json @@ -1,5 +1,13 @@ { "classes": { + "nextPointer": { + "components": { + "np": {}, + "tag": { + "tag": "next_pointer" + } + } + }, "camera": { "components": { "camera": { diff --git a/android/assets/level0.json b/android/assets/level0.json index fb410ba..5aeeaae 100644 --- a/android/assets/level0.json +++ b/android/assets/level0.json @@ -78,6 +78,13 @@ "properties": { "position": ["100", "100"] } + }, + + { + "inherit": ["nextPointer"], + "properties": { + "nextLevel": ["level1.json"] + } } ] } diff --git a/core/src/com/github/oldnpluslusteam/old41_game/components/NextPointer.java b/core/src/com/github/oldnpluslusteam/old41_game/components/NextPointer.java new file mode 100644 index 0000000..0b252d2 --- /dev/null +++ b/core/src/com/github/oldnpluslusteam/old41_game/components/NextPointer.java @@ -0,0 +1,27 @@ +package com.github.oldnpluslusteam.old41_game.components; + +import com.github.alexeybond.partly_solid_bicycle.game.Component; +import com.github.alexeybond.partly_solid_bicycle.game.Entity; +import com.github.alexeybond.partly_solid_bicycle.game.Game; +import com.github.alexeybond.partly_solid_bicycle.game.declarative.ComponentDeclaration; +import com.github.alexeybond.partly_solid_bicycle.game.declarative.GameDeclaration; +import com.github.alexeybond.partly_solid_bicycle.util.event.props.ObjectProperty; + +public class NextPointer implements Component { + @Override + public void onConnect(Entity entity) { + entity.events().event("nextLevel", ObjectProperty.make()).use(ObjectProperty.STRING_LOADER); + } + + @Override + public void onDisconnect(Entity entity) { + } + + public static class Decl implements ComponentDeclaration { + + @Override + public Component create(GameDeclaration gameDeclaration, Game game) { + return new NextPointer(); + } + } +} diff --git a/core/src/com/github/oldnpluslusteam/old41_game/modules/StartupScreenModule.java b/core/src/com/github/oldnpluslusteam/old41_game/modules/StartupScreenModule.java index 9209771..927a9dd 100644 --- a/core/src/com/github/oldnpluslusteam/old41_game/modules/StartupScreenModule.java +++ b/core/src/com/github/oldnpluslusteam/old41_game/modules/StartupScreenModule.java @@ -3,6 +3,7 @@ import com.github.alexeybond.partly_solid_bicycle.ioc.IoC; import com.github.alexeybond.partly_solid_bicycle.ioc.IoCStrategy; import com.github.alexeybond.partly_solid_bicycle.ioc.modules.Module; +import com.github.oldnpluslusteam.old41_game.components.NextPointer; import com.github.oldnpluslusteam.old41_game.components.mechanic.MountPointComponent; import com.github.oldnpluslusteam.old41_game.components.mechanic.MountableComponent; import com.github.oldnpluslusteam.old41_game.components.mechanic.MouseController; @@ -32,6 +33,8 @@ public Object resolve(Object... args) { map.put("mmc", MouseController.Decl.class); map.put("mmount", MountableComponent.Decl.class); map.put("mmp", MountPointComponent.Decl.class); + + map.put("np", NextPointer.Decl.class); } @Override