Teclis01's Forum Posts

  • The loops seems working but no... i'm wrong

    anyone knows how to retrieve a specific Sprite from it's uid and make action on it?

  • I found a solution by replacing the loop for with a loop foreach.

    https://www.scirra.com/tutorials/418/for-each-tutorial

    In fact it seems that in foreach loop it set the instance variable and it's not the case of loop for...

  • this is my condition/subcondition and actions

    (i use the example with 'R' key pressed

    Condition/subcondition :

    System => For "bulletsLoop" 0 to bulletsAlive.Width

    System => Bullet(bulletAlive.At(loopindex)).key == "R"

    Actions :

    ...

    bulletsAlive => delete loopindex from X axis //keep the array up to date

    System => stop loop //don't go further

    How can i get the instance returned by Bullet(bulletAlive.At(loopindex)).key == "R" ?

  • Hello,

    I made a transparent sprite who spawn one or more sprite.

    Sprite instance generated have instance variables as a keyboard key (like 'R' for representing 'R' of the keyboard and a Red bullet on the player's screen)

    Each time a sprite is spawn, i put the uid's sprite in an array

    when a sprite spawned meets a condition that is too late for player for typping the key, i remove the uid in my array and i destroy the sprite (referenced by condition on Sprite)

    A user's action can make destroy before meeting condition just explain before by typping the good key.

    I want to destroy the first Sprite who correspond in my array to the key pressed.

    this is a representation of my array when users press a key

    [0]=32

    [1]=33

    [2]=35

    [3]=36

    [4]=37

    [5]=38

    [6]=39

    [index] = uid of sprite

    I have already made a loop on the array to find Sprite by uid and find the first Red Bullet sprite to destroy and then stop loop

    My question is about how to find the first instance with key=='R' in their instance variable.

    Can somebody explain or show me an example?

    I check for uid documentation but i only found that uid is unique and defined at runtime now the way to get the Object behind an UID.

    Thanks a lot!

  • Hello!

    I would like to know if it's possible to read music on the platform the user is.

    For example would it be possible to read music from an Android phone, tablet, iphone, ...

    It seems that C2 can read Ogg Vorbis (.ogg) and MPEG-4 AAC (.m4a) but from the project.

    Any one knows?

    Thanks

  • I look for a answer in the manual and i found only that :

    https://www.scirra.com/manual/75/how-events-work

    This link mention multiple condition but not with a loop.

    I think i could do that multiple condition by setting a flag but i ll set this flag n times in the loop... that seems so strange to write that...

  • Hello

    I know what i would like to do but i don t know how to do that in C2...

    I get a server response and fill some information in a list (the list contains the list of levels available)

    => Fired on start of layout call a server, when reponse is success, this call a function.

    => Fired On call of the function AND There is a loop to populate the list

    The player choose the level he wants to play

    =>Fired by on selection changed

    I would like to preloads few sound needed for the next layer

    =>Fired by Audio all preloads complete

    I would like all theses actions are done, to set visible the button witch permits to go the the next layer.

    How can i wait until all is done?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I find the method to tokenize data so it ll be easy!

    I'm not sure that is a good idea to send JSON, Plain will be enough...

    What do you think about that?

  • Hi

    I just try Ajax feature and would like to make more than just requesting, i would like to use datas returned by server.

    So, to understand, i made a php script returning a simple C2 array

    Echo of the PHP script

    {"c2array":true,"size":[4],"data":["Level1","Level2","Level3","Level4"]}
    [/code:3bsebibk]
    
    I try to put that in a C2 Array and it work well
    Now i would like to populate a [url]https://www.scirra.com/manual/155/list[/url]
    
    How could i iterate on each data to use List method named Add item
    Is there a better way to load that ?
  • I already check manual when you mention function

    I duplicated a lot of code and binded instructions (listenner/handler) by a strange way, i ll not do it anymore!

    In fact by using tutorials and few examples, i thought it was the good way... but i mistake. I'm going to check the entire manual before doing errors like that...

    Indeed, i thanks you again for your replies!

  • Oh my gosh!!! how can i miss that Oo

    You just learn me that there is Function's Object in C2!

    I thought that it was only event oriented programming on sprite, variable,system and i find it just by double clicking... The "Function" Object

    I look a lot of information in manual, made few tutorials and check a lot of example but never see use of that Object...

    I'm sorry about asking you all... You opened my eyes <img src="smileys/smiley36.gif" border="0" align="middle" />

    Anyway i thanks you a lot cause i was missing that feature.

    Oh my gosh i must hide somewhere <img src="smileys/smiley9.gif" border="0" align="middle" />

  • The link seems to be dead...

  • My solution eats a lot of CPU, you are right ^_^ but i haven't understand yours that's why i ask for explanations and you compare solutions very efficiency!

    I think i miss some kind of condition to implement your solution. If you have to make the same, what condition will you use to "fire" instruction(s)?

    -System. Compare Time

    -System. Compare two values

    -System. Every tick =>seems to be the worst...

    -another?

    I would like to use yours cause you seems to be experienced on C2 <img src="smileys/smiley9.gif" border="0" align="middle" />

  • Oh thanks you so much!

    In fact you can't design a Object like "standard" language with members, methods,... but you store it in a kind of structure where an index represent a member, in fact an array.

    Now i understand what you were meaning by storing an object.

    But i'm still thinking about the design of your solution.

    Your solution seems like that right?

    (the content is given for example)

    [0][0]=0.2 (in second for timestamp)

       [1]="T"

    [1][0]=0.5 (in second for timestamp)

       [1]="LR"

    [2][0]=0.9 (in second for timestamp)

       [1]="T"

    [3][0]=1.2 (in second for timestamp)

       [1]="D"

    I don t understand the need of the index of obstacle and how to know on what index the system is

    Would not it be better to use embeded condition "Every 0.1s" Add 1 to a variable that represent Array index and make an array like :

    [0]=""

    [1]=""

    [2]="T"

    [3]=""

    [4]=""

    [5]="LR"

    [6]=""

    [7]=""

    [8]=""

    [9]="T"

    [10]=""

    [11]=""

    [12]="D"

    ?

    Anyway thanks you for explanations!

    Edit : An array always begin at 0.

    As we say in French : "Les geeks n'ont pas une case en moins ils commencent juste ? partir de 0"

  • Thanks for the answer!

    In fact in programming language (Java, js, ...) i know how to store an object at an index of an array/list or Map/dictionnary but i don t know how to do the same in Construct 2 :(

    Have you an example?

    I should store an array to store 2 (or more) Arrows at the same time.

    I m not as fluent as others programming language for now but i learn a little more each days ^^