This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
co = coroutine.create(function()
logmsg("run")
QuestionScreen:Ask(co, "Yes", "No") -- this pops up a GUI asking a question
coroutine.yield() -- this waits until the GUI input function gets its answer but does not block the engine.
if QuestionScreen.Selected == 1 then
PlayerAvatar:Say("Lol")
else
PlayerAvatar:Say("Not Lol")
end
end)
coroutine.resume(co)
void Light::Draw()
{
int i;
while (i < Game.CharacterCount)
{
if (character[i].Room == player.Room)
{
ViewFrame *vf = Game.GetViewFrame(character[i].View,character[i].Loop, character[i].Frame);
charSprites[i] = DynamicSprite.CreateFromExistingSprite(1); //reset the sprite. this will need to be more complex with actual animating sprites but thats by the by atm.
vf.Graphic = charSprites[i].Graphic;
}
i++;
}
float u = 0.0;
while (u < 360.0)
{
raycast(this.ID, u);
u += degStep;
}
ds.Release();
while (i < Game.CharacterCount)
{
ViewFrame *vf = Game.GetViewFrame(character[i].View,character[i].Loop, character[i].Frame);
vf.Graphic = charSprites[i].Graphic; //set vf to sprite to remind the engine that the sprite has changed (bug?)
i++;
}
}
void raycast(int light, float a)
{
int xx, yy;
a = Maths.DegreesToRadians(a);
float d = 0.0; // distance from light
int str = 100; // light strength. Linear falloff, will do more believable falloff later.
while (d < 100.0 && str > 0)
{
xx = FloatToInt(Maths.Sin(a) * d) + lights[light].X;
yy = FloatToInt(Maths.Cos(a) * d) + lights[light].Y;
if (xx < 0 || xx > 320 || yy < 0 || yy > 200) str = 0;
else if (Character.GetAtScreenXY(xx, yy) != null) // hit character
{
Character *c = Character.GetAtScreenXY(xx, yy);
DrawingSurface *cds = charSprites[c.ID].GetDrawingSurface();
int x = xx - (c.x - (charSprites[c.ID].Width / 2));
int y = yy - (c.y - charSprites[c.ID].Height);
int col = GetRFromColor(cds.GetPixel(x, y));
col += str / 4;
if (col > 255) col = 255;
if (col < 0) col = 0;
cds.DrawingColor = Game.GetColorFromRGB(col, col, col);
cds.DrawPixel(x, y);
cds.Release();
str -= 50; // reduce strength from character hit to simulate rimlight
}
d += 1.0; // advance distance
str --; // linear falloff
}
}
Display("Well hi there! Click Ok on the next GUI you see!");
WaitWhileWeShowGUIModally();
Display("You clicked OK! Good for you!");
StoryState.RegisterNode("Start", null);
StoryState.RegisterNode("GotSword", "Start");
StoryState.RegisterNode("GotMonkey", "Start");
StoryState.RegisterNode("StabMonkey", "GotMonkey,GotSword");
StoryState.RegisterNode("EnterParty", "StabMonkey");
StoryState.SetFlag("GotSword", true, false);
// You can check a flag with:
if (StoryState.GetFlag("GotSword")) // etc
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.166 seconds with 15 queries.