Solomon's Recent Forum Activity

  • I am trying to solve an issue, for 3 hours straight and seem to be getting nowhere.

    Im not sure if this can be achieved thus I decided to ask here all you gurus.

    I have 2 instances of the same object type, lets say 2 balls.

    Both are spawned randomly, at 2 different locations, one on left half of the screen the other on the right half.

    So far so good.

    Now comes the tricky part.

    Is it possible, in order to save memory to spawn the ball on the left side of the screen to always move right, and the ball on the right side on the screen to always move left, all using 2 instances of same object type, no behaviours and done in events?

    Ive been trying to find some sort of variable that could be manipulated from withing the event sheets, that could be manipulated seperately for each instance that has been created.

    Ive tried families, but manipulating family instances from the event sheets cant focus on one instance, rather changes all the values for all the instances when manipulated.

    I worked some time ago in another program smillar to Construct2 (will not mention which one for obvious reasons), and what I did there is I managed to add each instance created to a list, and name each instance seperately as it was created. In that way I was able to call out by name each instance and get a hold of each instance seperately (the list wasnt long, it had 5 places and the instances that left the screen had been removed from that list).

    Either this is very easy and Im getting tired and my mind isnt working anymore, or its hard and the only solution is to create another object type of that object which travels right, and give it another variable seperate from that instance that travels left.

    In Construct 2 I find it tricky to get a "hold" of a "unique" instance to be able manipulate only it from directly from event sheet once it was loaded by events.

  • you cant write... create family member with instance variable "apple"

    I want to create an instance variable "apple" from the family at random pick by setting up a variable text which will control and be linked to the names of the different sprites in the scene, more or less.

    Well the problem is that the family variable instances cannot be directly called upon with an event in order to spawn that particular familly member, from what I have been trying to do and what the others have suggested. There is no way to connect the name of a particular sprite to a family instance variable from what I see. Giving a family member a family instance name the same as its sprite name does not work.

    The way you have done it, it is going to work is if there are only apples in the family.

    The family is not only apples, but its all the fruits. So apples oranges and bananas.

    So if the system is going to check wether there is a fruit in the family instance variable per family object, it will find each kind of fruit to be there.

    Besides I have other sprites of the same family in the scene, and in the loop the family is destroyed and that is why all the other family members in the scene will get destroyed too, which is something I dont want.

  • I mean something like this..

    so when you create sprite from family c2 take a random sprite..if is random sprite =Random pick..Stop

    else destroy and create new sprite..until you find Random pick

    The Signature is a Family instance from what I see.

    If I understand correctly...

    Well if the family has 3 objects, the apple orange and banana, it doesnt matter which will be randomly chosen at the beginning because the signature will always = whatever has been randomly picked, as I will need to input in the signature: apple, banana, orange.

    I want to create an apple if the apple is randomly chosen, from a family where all 3 - orange banana and apple are inside the family, and not do it manually in case I end up with 50 different objects.

    So I am looking for something simillar to create by text name "". So create "text global variable" object or something equivalent would be spot on.

  • if you use while loop and "Random_Pick"?"Signature"...Destroy ?

    like in this capx WhileDestroy.capx

    just spawn families and check "Signature2...

    Yes but you are setting the animation frame to a different frame to load a sprite. I cannot do that because I have different sprites with different animations that I want to load.

    I need to reference the created object by text inside a global variable, so that the text chosen will transfer itself to the object as both will have the same name.

  • I'm sorry that it did not work, I looked up and tested it and it really did not work. As far as I know (now) you have to do this manually, there is no literal option for this but you can only make it easier by using the function plugin, arrays or commonly use variables.

    Hey no problem, at least we both learned something which is always good.

    I really do hope there is another way to solve this faster instead of manually entering each event.

    Still hoping someone can help me on this, if not well in the end Ill just use the call functions as you mentioned.

    One thing that could work if it was possible is adding an item to a family in events, and then checking if that item is in the family by comparing the family variable instance. Need to look into it, not sure if its possible to add an item to a family with events only.

  • [quote:2udrl499]

    "First Make sure the Global Variable Values are text and returns the Sprite Names when you randomize it."

    1) Make a Family and add all the sprites that you want to create.

    2) Add an Instance Variable in the Family called "Signature" (or anything you want) returning a Text value.

    3) In the Project Bar , set the Instance Variable "Signature" of each sprite the same as their name.

    4) Make this event :

    Condition: Pick by comparison.... Global Variable = Family.Signature

    Action: Create Object : Family at (X,Y)

    Lets say I have: apple|orange|banana in my Fruit_family.

    The sprites are called apple, orange and banana respectively.

    Also I created a text variable: Random_Pick=""

    At the beginning there is a draw = pick either: apple, orange or banana.

    All is good, that all works I get the desired output when using output value to text.

    At this moment when I draw orange I get Random_Pick="orange"

    Now I would like for the Fruit_family to spawn the orange that I the system has randomly picked at the beginning at a certain location.

    I did as you suggested, added "Signature" Instance Variable to the Fruit_family, and named each of the objects as their sprites:

    apple=apple, orange=orange, banana=banana

    Then I added the compare 2 values, and compared: Random_Pick=Fruit_family.Signature.

    Then create object Fruit_family on specified layer and location.

    From what I understand, the system is now looking if the Random picked fruit is present in the family signature and if it is, it is spawning a random object from that family, and not the exact fruit that was picked at random at the beginning.

    So I am getting random spawns every time, so when the pick is apple I get a random object spawn instead of the spawning apple.

    Its a shame that there is no further optional branching after selecting the create object Family ---> pick specific object in that family to create.

    Will try the other option regarding caling the function in a couple of hours.

  • I have a marker and I would like to load into it a random object.

    Now the reason for this, is that I would not need to set events for each object that I load into the marker, instead set the events for the marker and the objects will load into it and retain its events.

    Basically the idea behind this is to have a random picking system which I have done so, and when a number is hit it picks out an object/sprite.

    Then, there is an event where I create the object, but I would like to be able instead of going through all the possibilities, to substititue create "object" with a variable that has been randomly picked at the beginning, if that makes sense.

    The only thing Im not sure of is how to substitute the "object" in "create object" event with a variable name that had been picked out earlier.

    All of the objects have their own animations, so using the strategy of having different sprites on different animations/frames and changing the frame numbers to get a different object loaded will not do.

    As always, thanks for the help.

  • ahr Ech

    Your reply is much appreciated.

    Happy Happy Krampusnacht plays very well, and it works well in fullscreen mode.

    Just one more question before I leave you alone if thats ok.

    Have you ever tried exporting in higher resolutions strictly for desktop? (because as I understand exporting as your current resolution is also leaving a possibility for mobile export).

  • Create a step by step guide on how to get accepted by Nintendo into its developer program

    Oh, that and continue to kick tushy with smokin games of course

  • You do not have permission to view this post

  • zenox98

    I have read around the forums and people suggested not to use too many event sheets, perphaps a couple at most.

    I will try it out and report back if I encounter an issue.

    R0J0hound

    Ok I will look into it, thanks for the input.

  • Or I could simply use more even sheets... But I have read that too much isnt healthy for C2 stability. Guess I will find out

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Solomon's avatar

Solomon

Member since 22 Aug, 2015

None one is following Solomon yet!

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies