Added Encryption Support

This commit is contained in:
adi1090x 2020-04-30 22:07:47 +05:30
parent 09e462804a
commit 19139ac506
406 changed files with 5830 additions and 8344 deletions

View file

@ -203,6 +203,5 @@ Red Loader|Splash
### FYI
+ Created and tested on machine with 1366x768 resolution.
+ Not tested on *encrypted* machines.
+ Yeah, that's how *quarantine* going on :grin:.
+ Stay Home - Stay Safe, Help Fighting CORONA.

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 41; i++)
@ -25,115 +46,62 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 76; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 24; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 30; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 61; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 164; i++)
@ -24,115 +45,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 68; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 101; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 48; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 72; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 156; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 96; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 375; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 89; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 120; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 120; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 210; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 81; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 62; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View file

@ -3,8 +3,29 @@
## Github : @adi1090x
## Reddit : @adi1090x
# set background colors
Window.SetBackgroundColor (000000);
// Screen size
screen.w = Window.GetWidth();
screen.h = Window.GetHeight();
screen.half.w = Window.GetWidth() / 2;
screen.half.h = Window.GetHeight() / 2;
// Question prompt
question = null;
answer = null;
// Message
message = null;
// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);
// Flow
state.status = "play";
state.time = 0.0;
//--------------------------------- Refresh (Logo animation) --------------------------
# cycle through all images
for (i = 0; i < 41; i++)
@ -25,115 +46,63 @@ fun refresh_callback ()
Plymouth.SetRefreshFunction (refresh_callback);
# dialogue --------------------------------
//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
question = null;
answer = null;
status = "normal";
if (entry == "")
entry = "<answer>";
fun dialog_setup()
{
local.box;
local.lock;
local.entry;
box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");
box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);
lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}
fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}
question.image = Image.Text(prompt, 1, 1, 1);
question.sprite = Sprite(question.image);
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}
fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
dialog.bullet[index].z = dialog.entry.z + 1;
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
# quit --------------------------------
fun quit_callback ()
{
logo.sprite.SetOpacity (1);
answer.image = Image.Text(entry, 1, 1, 1);
answer.sprite = Sprite(answer.image);
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
Plymouth.SetQuitFunction(quit_callback);
//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
state.status = "pause";
totalWidth = bulletCount * bullet.image.GetWidth();
startPos = screen.half.w - totalWidth / 2;
# message --------------------------------
prompt.image = Image.Text("Enter Password", 1, 1, 1);
prompt.sprite = Sprite(prompt.image);
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
// Clear all bullets (user might hit backspace)
bullets = null;
for (i = 0; i < bulletCount; i++) {
bullets[i].sprite = Sprite(bullet.image);
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
}
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
state.status = "play";
bullets = null;
prompt = null;
message = null;
question = null;
answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
message.image = Image.Text(text, 1, 1, 1);
message.sprite = Sprite(message.image);
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Some files were not shown because too many files have changed in this diff Show more