Something went wrong. Try again.
A very rough prototype kag tutorial rework
Something went wrong. Try again.
1.5 kB · 70 lines
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970//////////////////////////// TEST MAP/// /// This is a test with sector events./// This may break in the future
#include "EventSector"
SectorHandler@ handler;
void onInit(CMap@ this){ onRulesRestart(this, null);}
void onRulesRestart( CMap@ this, CRules@ rules ){ this.RemoveAllSectors();
@handler = SectorHandler();
handler.AddNewEvent( SectorEvent(HelloWorld, Vec2f(95, 419), Vec2f(184, 471), true) );
handler.AddNewEvent( SectorEvent(HelloWorld, Vec2f(260, 410), Vec2f(411, 469), false) );
handler.AddNewEvent( SectorEvent(HelloWorld, BombCheck, Vec2f(474, 410), Vec2f(617, 466), false) );}
void HelloWorld(CBlob@ caller){ server_CreateBlob("chicken", -1, caller.getPosition());}
bool BombCheck(CBlob@ caller){ CBlob@ blob = caller.getAttachments().getAttachmentPointByName("PICKUP").getOccupied();
if (blob !is null && blob.getName() == "mat_bombs") { return true; }
return false;}
void onTick(CMap@ this){ CBlob@ blob = getLocalPlayerBlob();
if (handler is null || blob is null) return; handler.OnTick(blob);}
void onRender(CMap@ this){ GUI::DrawText("One time use event", getDriver().getScreenPosFromWorldPos(Vec2f(115, 400)), SColor(255,255,255,255));
GUI::DrawText("Infinite use event", getDriver().getScreenPosFromWorldPos(Vec2f(300, 400)), SColor(255,255,255,255));
GUI::DrawText("Event with condition check", getDriver().getScreenPosFromWorldPos(Vec2f(520, 400)), SColor(255,255,255,255));}