Skip to content

Commit

Permalink
adds a working demo game!
Browse files Browse the repository at this point in the history
  • Loading branch information
ericoporto committed Jan 11, 2020
1 parent 367314e commit c2453c5
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 22 deletions.
6 changes: 3 additions & 3 deletions agsimgui_demo/Game.agf
Original file line number Diff line number Diff line change
Expand Up @@ -2303,8 +2303,8 @@
<ThinkingView>0</ThinkingView>
<BlinkingView>0</BlinkingView>
<StartingRoom>1</StartingRoom>
<StartX>127</StartX>
<StartY>142</StartY>
<StartX>110</StartX>
<StartY>147</StartY>
<UniformMovementSpeed>True</UniformMovementSpeed>
<MovementSpeed>4</MovementSpeed>
<MovementSpeedX>3</MovementSpeedX>
Expand Down Expand Up @@ -2336,7 +2336,7 @@
<Character>
<ID>1</ID>
<ScriptName>cNeutralBot</ScriptName>
<RealName xml:space="preserve">New character</RealName>
<RealName>NeutralBot</RealName>
<NormalView>1</NormalView>
<SpeechView>0</SpeechView>
<IdleView>0</IdleView>
Expand Down
Binary file modified agsimgui_demo/room1.crm
Binary file not shown.
Binary file modified agsimgui_demo/room2.crm
Binary file not shown.
74 changes: 55 additions & 19 deletions agsimgui_demo/room3.asc
Original file line number Diff line number Diff line change
@@ -1,37 +1,63 @@
// room script file

Dictionary* SpokenStrings;
String keys[];
String keys[128];
String values[128];
String character_name[128];
int key_count;

void SayB(this Character*, String text){
if(!SpokenStrings.Contains(text)) {
SpokenStrings.Set(text, text);
keys = SpokenStrings.GetKeysAsArray();
key_count = SpokenStrings.ItemCount;
String text_to_speak;
if(!SpokenStrings.Contains(String.Format("%s##%s", this.Name, text))) {
text_to_speak = text;
SpokenStrings.Set(String.Format("%s##%s", this.Name, text), String.Format("%d",key_count));
character_name[key_count] = this.Name;
keys[key_count] = text.Copy();
values[key_count] = text.Copy();
key_count++;
} else {
String index = SpokenStrings.Get(String.Format("%s##%s", this.Name, text));
text_to_speak = values[index.AsInt];
}

this.Say(SpokenStrings.Get(text));
this.Say(text_to_speak);
}



function room_RepExec()
{
AgsImGui.NewFrame();
AgsImGui.BeginWindow("My own window");

AgsImGui.Text("Talk and inspect things in the room.");
AgsImGui.Text("You can rewrite what is said!");
AgsImGui.Separator();

if(key_count>0){
for(int i=0; i < key_count; i++){
AgsImGui.Text(keys[i]);
String key = keys[i];
String value = values[i];

AgsImGui.Text(key);

//String result = AgsImGui.InputText(String.Format("%d",i), SpokenStrings.Get(keys[i]));
if(AgsImGui.IsItemEdited()){
// SpokenStrings.Set(keys[i], result);
String result = AgsImGui.InputText(String.Format("%d %s", i, character_name[i]), value, 256);
if(result!=null){
values[i] = result;
}
}
}

AgsImGui.Separator();
AgsImGui.Text("This is an example of possible Editors to build with AgsImGui!");

AgsImGui.EndWindow();

if(key_count > 3){
AgsImGui.SetNextWindowPos(16, 16, ImGuiCond_Always);
AgsImGui.BeginWindow("End Demo",false, eImGuiWindowFlags_NoTitleBar);
if(AgsImGui.Button("Click Here to End Game")) QuitGame(0);
AgsImGui.EndWindow();
}

AgsImGui.Render();
}

Expand All @@ -44,13 +70,6 @@ function room_Load()
SpokenStrings = Dictionary.Create(eSorted, eCaseSensitive);
}

function room_AfterFadeIn()
{

}



void on_mouse_click (int btn){
if(btn == eMouseWheelNorth){
AgsImGui.DoMouseWheel(eImGuiDir_Down);
Expand All @@ -64,3 +83,20 @@ function oObject0_Talk()
player.SayB("Who are you?");
cNeutralBot.SayB("I am the Neutral Bot!");
}

function hHotspot1_Look()
{
player.SayB("Lights here are low...");
}

function hHotspot2_Look()
{
player.SayB("If this was a real game, I would pick this rope!");
}

function hHotspot3_Look()
{
player.SayB("Lots of pipes...");
cNeutralBot.SayB("Don't have any fuzzy ideas!!!");
player.SayB("I won't hurt you, they forgot to script this. Or I could...");
}
Binary file modified agsimgui_demo/room3.crm
Binary file not shown.

0 comments on commit c2453c5

Please sign in to comment.