Level Select

2

Stats

11,103 visits, 17,839 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 27 May, 2012. Last updated 19 Feb, 2019

ok, today i'm not going to do a tutorial made from me but its 100% made from @ramones so thanks to him for everything he made ^^

so lets start first of all download this folder here

it has all sprites that im going to use, and also you can see the result of the .capx

also i left the lock,star icons so you can make your own level sprites.

Some Tips to Help The Forum (not from the lesson)^^

first download DropBox when you install it in your PC there will be a folder in your desktop and inside it there is a public folder ,create a folder called : scirra construct2 , and put everything for scirra inside of it

, so in this way all your files will be shared when you put links in the forum also you will know this folder for forum so i shouldn't delete it to let newer people to use my files and learn construct2.

Do the basics:

ok now we will open new tab in contruct2 by click Ctrl+N and click save in single file.

after that double mouse left click (2click) on the white page then click sprite and insert

then add some frames by right-click on this

ok after that insert these 2 pictures in the frames :

and put the speed of the frame to 0 also make 3 animations called :(1star,2star,3star).inside these frames put the pictures that has same star number for example 1star.png on animation "1star" and so on...

after all that insert star.png and complete.png , and win.png as sprite like the level.png we just did before.

also add event sheet and layout by right-click on layouts and event sheets folders.

also 2click on white page and insert mouse (plugin) and array (plugin).

inserting objects to start events

ok in the first layout (layout 1 in the example) put the levelsbutton (level.png) and put 12 of them and if you want to put them with same size,same positions click (tab view ==> check snap to grid) and put grid like 30 or 50 and keep changing sizes and positions they will move the same spaces between levels like this :

and put a number variable to this sprite (called level in this example). and give each sprite a variable start from 0.

in the 2nd layout (Level in the example) put the win,complete and star objects and copy the stars 3 times and give the star object a variable (variable1 in the example) give the stars number (1,2,3).

Array and Event sheets

array:

in the array properties you will see (width,height,depth)or (x,y,z) anyway we will change one thing for know because all our work will be in the levelbutton object so change the (width or x) to the number of levels that you made (the copies of levelbutton sprite) so in this example its 12 then change it to 12 and leave yz as it is 1,1.

Event sheet:

as we said before we have 2 event sheet (1 for levels page , 1 will be in all the other layout if you want to make more than 2+ sheets)

first event sheet (event sheet1 in the example) you will put a global variable(we called :currentlevel)start from 0 as the first levelbutton variable.

-now ill put number of event and how it says then ill explain it a comment picture

1-system on start of layout :(empty actions)

=>array currentlevel=0 :

                         array set value carrentlevel=1

=>system for each levelbutton :

=>array(level) value at levelbutton.level=0:

                                               set animation frame to 1

=>array(level) value at levelbutton.level=1:

                                               set animation frame to 0

=>array(level) value at levelbutton.level=2:

                                               set animation frame to 2

=>array(level) value at levelbutton.level=3:

                                               set animation to "1star"

=>array(level) value at levelbutton.level=4:

                                               set animation to "2star"

=>array(level) value at levelbutton.level=5:

                                               set animation to "3star"

2-mouse left click levelbutton

and value levelbutton.level>0 :

                                   go to level
                                   set currentlevel to levelbutton.level

ok now go to 2nd event sheet (level events in the example)

and put a global variable = 0 (we call it stars in the example) then,

1-system on start of layout :

                              system set stars to 0

2-mouse clicked on win :

     array set value at currentlevel max(2+stars,levelsat(currentlevel))
     system add 1 to currentlevel
     go to layout1

3-mouse clicked on complete :

     go layout1

4-mouse clicked on star :

     star destroy
     add 1 to stars

somethings you need to notice :

1) the 2nd sheet should be in all the levels that you going to play in.

2) the array should be global from properties tab.

3) you don't need a variable in the star object.

4) you don't need to keep following step by step , for example in actions you can make anything on it ^^ just try to miss up and see what happen :P

ok now i finished the whole level page so if you have a question or point or comment or anything feel free to ask , if i couldn't answer it you can ask in the forum because i'm not that kind of programmer to know everything im a person like you ^^

before you ask me a question : check this topic you may find some stuffs on it that could help you

http://www.scirra.com/forum/topic54000_post337650.html#337650

also this a way how to storage the select level ^^

http://www.scirra.com/forum/webstorage_topic54521.html?KW=select+level

about days ago my friend (ConstructDude) made a great step by step video tutorial about this one and i really loved it , thanks for him and subscribe to his channel he is the best construct2 video maker :) let's help him to become the official construct2 video tutorials ^^

level select video tutorial :

if you didn't find something to help you ask in the same topic with @zsangerous so i get a notification and ill try to help you ^^

thanks for reading ^^

good luck

by salem

#sorry if i edited the post alot i was testing somethings

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Could anyone explain to me this part?

    "

    2-mouse clicked on win :

    array set value at currentlevel max(2+stars,levelsat(currentlevel))

    system add 1 to currentlevel

    go to layout1

    "

    what did the OP mean by "levelsat" ?

    • You may want to post your question in the forum with a link to this tutorial. This tutorial is from 2012, it's possible that Construct does it differently now.

      Wish I could help, but I'm here learning about arrays also (: