How to display random phrases in random time in a framework

0 favourites
  • 8 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • buenas, necesito hacer lo siguiente..he rebuscado ya durante varias horas pero no...ni idea.

    En fin, tengo un marco donde quiero que vayan apareciendo frases cada x y al azar.

    quería crear algo como que el sistema fuera añadiendo a ese marco cada x tiempo jugando con variables...pero no tengo idea de como hacerlo.

    supongo que podría hacer una orden para cada frase , que se cree cada x segundos después de la otra....pero quería saber si se puede crear como una base de datos, donde se vayan mostrando en un display o hud , datos de esa base, de manera random y cada x tiempo....

    voy a intentar traducirlo con google por si algún giri me puede ayudar.....

    well, I need to do the next ..i already fetched for several hours but no ... no idea .

    Anyway, I have a framework where I want they appear random sentences each xy .

    I wanted to create something like the system to be added to that frame each time playing with variables x ... but I have no idea how.

    I suppose I could make an order for each phrase , believed every x seconds after the other .... but wanted to know if you can create a database, where they will show on a display or HUD , the data base, random way and each x time ....

  • You can store the sentences in an array. Just drop the object in your layout. Then at start of layout set x 0 = "This is the first sentence", x 1 = "this is the second sentence."

    You can use a for each loop under the cog for the array.

    You can also use dictionaries. I find them to be easier. They work with keys.

    start of layout set key 1 = "first question" value = "this is the first question."

    Then use a foreach under the cog wheel to loop through the dictionary.

    sub event

    compare two values.

    if the first field Dictionary.CurrentKey

    the second = "first question"

    Then in the actions you can set text position, random x,y using layout width and height.

    set text = dictionary.CurrentValue

  • thank you very much ! i test tomorrow ! thz !!!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • well sorry i cant understand that....i dont know how to add sentences to the dictionary or array, and how to call to appear in the display....

  • ok i know how to give some values to the array but i dont know how to make a call for display the values....

  • Well it is unclear what you refer to as "framework".

    To display a sentence, you need to have some display object in your project such as Text or Spritefont.

    From there, you either fill an array/dictionnary on start of the first layout of your game, the array being global you can access it from any layout in the game.

    Here is a simple example using an array.

    Execute the project starting from layout 1, or it won't work.

    On startup of Layout 1 an array is filled with various sentences.

    Then, in layout 2 every second, a sentence is picked out of the array and displayed in the text object.

  • ok thz let me check

  • I could apply to my game! really thz !!!!! <3

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)