How to create message box in Construct 2?

Discussion and feedback on Construct 2

Post » Fri Sep 21, 2012 5:11 pm

Are there any tutorials to create message box in a game?
B
5
Posts: 18
Reputation: 536

Post » Sat Sep 22, 2012 6:05 am

What do you exactly mean by message box? Like in game text or a pop up window?
B
47
S
10
G
6
Posts: 455
Reputation: 8,326

Post » Sat Sep 22, 2012 1:53 pm

Yes a game text letting the user know either of High-score or some sort of achievement
B
5
Posts: 18
Reputation: 536

Post » Sat Sep 22, 2012 2:44 pm

First of all ... Next time you want to ask something , go to the help section

Second ... Before you ask something , check the manual ! ... Or ask me :D

If you want to make multiple acheivements , you will need a lot of variables , but you can use Clay.IO for easy achievements and leaderboards !


kbdmaster2012-09-22 14:48:24
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Sat Sep 22, 2012 4:43 pm

Ah thanks for that I have read the manual and all that, and I know clay.io, I mean to say something like modal pop-out, let me paste the photo of want i want to achieve


https://dl.dropbox.com/u/87147999/CityVille_Message.jpg

can we make this as an alert box thing?
B
5
Posts: 18
Reputation: 536

Post » Sat Sep 22, 2012 4:49 pm

Or look at this pic


https://dl.dropbox.com/u/87147999/2nghc41.jpg
B
5
Posts: 18
Reputation: 536

Post » Sat Sep 22, 2012 7:02 pm

[QUOTE=kbdmaster] First of all ... Next time you want to ask something , go to the help section

Second ... Before you ask something , check the manual ! ... Or ask me :D

If you want to make multiple acheivements , you will need a lot of variables , but you can use Clay.IO for easy achievements and leaderboards !


[/QUOTE]

This comment does not address the question and is extremely unhelpful.




Anyways, to address your question on a message box.

Credit goes to septeven for writing a dialog box plugin that might do what you are hoping for.

http://www.scirra.com/forum/plugin-dialog-box_topic46991.html

The comments say there might be some issues with chrome im not sure, check it out and see if it accomplishes what you need.
B
8
S
1
Posts: 61
Reputation: 1,210

Post » Sat Sep 22, 2012 10:39 pm

I had the same issue - how to make a modal dialog. You have to do it manually, unfortunately. Below is my experience.

Note: there is no way to make a sprite disabled, i.e. any sprite, no mater if its invisible, or on an invisible layer, or even under other sprites not get a touch/click event.

Here are the strategies I tried:

1) Make a layer above your game layers, and make the layer invisible (There is a check box "Initial visibility" which you can set in the layer settings in the editor, and a check box in the layer panel to make it invisible in the editor when you are done.
2) Put your game UI input code in one group (or a small number of groups). This group is enabled by default. Put your dialog input events in another group, and make it disabled by default (under group edit in context menu)
3) When you want to make your modal popup:
a) disable your game input group (System->General->Set group active).
b) make your dialog layer visible.
c) Enable your dialogue UI group.
4) reverse this when you want to close the group.

This seems to be the recommended approach, but it didnt work for me as I could not put all my UI code in one group, UI code is spread out in separate event sheets and modularized for maintainability. Also, I have many different modal dialogues, and so I ended up trying to track several groups which turned out to be untenable in a complex project (by brain is too small).

Instead I took a different approach.

I leave all UI components active for input (i.e. dont put them in groups). For all my 50+ input events (e.g. "touch->On touch start", "touch->On touched Start" I have a second or third condition which I check the visibility of various layers to deduce which "screen" I am on, i.e. one of several modal dialogues, one of 2 help screens, a settings screen, a game level etc. This was better, but still gave me a headache.

The current strategy I use is to create modal dialogs within the dotted line of the layout editor, but when the game starts (On layer start), I move the contents of the dialog layers 1024 pixels to the left or right. I then "slide" in the modal screens (such as the settings page) in and out when needed like the swipe on an ipad. This keeps their input out of the way of being pressed. You cant move or animate a layer, unfortunately, so the best way is to put all the sprites in a family, then use "settingsFamily Move 1024 pixels at angle 180". The problem is you cant put text in the family with the sprites for some reason. So then you have two strategies:
1) pin the text items to one of the sprites.
2) put the text sprites in their own family, and always move both.
I started off with 2), but recently Ive do all my dialogs with 1), which turns out to be more maintainable, although it does mean a lot of pin code in your "on start of layout". Its a shame you cant pin one object to another in the editor.
For the swiping part, there is no tween or animated move to (unless you use one of the many plugins for this), the next best thing is the bullet behavior. However, this wont get the screen exactly to the required destination X, you have to either accept it being approximate, or then manually move it to the exact correct position after. I do a bit of both (if you make the dialog narrow, you can get away with the former).

I must admit, it's more work than any other system I have developed with in the last 30 years (ok, I;m old - I wrote my first space invaders game when I was 14 on the ZX81 in Z80 assembler).

nutmix2012-09-22 22:51:09
B
15
S
5
G
2
Posts: 357
Reputation: 3,691

Post » Mon Sep 24, 2012 9:19 am

Thats was really helpful, the plugin link you provided. It worked
B
5
Posts: 18
Reputation: 536

Post » Mon Sep 24, 2012 9:22 am

Thanks Twinsonian    
B
5
Posts: 18
Reputation: 536

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests