timcs's Recent Forum Activity

  • Hi

    Following on from this post :

    I need to be able to count and find records with the same value in them and then get both the key and value from that. I am sure this is simple but I cannot see a way of doing this

  • Please download this demo I created:

    https://www.dropbox.com/s/0jptlam49u7ugse/spawningDemo.capx?dl=0

    I hope it answers all your current and future questions

    Thank you again dop2000 I really appreciate your help with this, I will try not to bother you again

  • [quote:1vrwfzku]So in your example is the enemytype set against the enemy object or the spawnpoint or both?

    EnemyType instance variable is defined on the spawnpoint object. And then you set it either to "z" or "v" for each of the 24 spawnpoint instances that you have.

    You can do something similar with enemies objects - create a bunch of instance variables to store enemy type, health, damage, armor etc. etc..

    Note, that I updated the picture in my previous comment, there was a slight mistake - you need to first pick spawnpoints by EnemyType and then loop through them.

    Hi dop2000 , I must be missing something with my logic here because using your example (the updated one) no objects are being spawned

    How does the enemytype variable logic work , if I am calling this by a function, does this need a parameter?

    ** EDIT **

    Found the issue missed out the * loopindex after the wait 0.5 doh! . However with your logic the overlapping issue has come back, should I still be using the used true/false or destroy options ?

  • [quote:udk3m9am]Hey brunopalermo would this variable be assigned to the spawnpoint object ? and then if it was true e.g. used then don't use that spawnpoint ?

    Exactly. Using instance variables with spawnpoints you can do lots of things - mark them as used, temporary enable/disable them, keep track or set limit of how many objects (let's say enemies) they spawned, specify which type of enemies each spawnpoint can produce, set an order in which they will be selected for spawning etc.

    Instance variables is a powerful stuff

    In your case, if you have 24 spawnpoint and would like, for example, half of them to spawn zombies and half to spawn vampires, you can add an instance variable EnemyType, set EnemyType="z" for 12 spawnpoint and EnemyType="v" for the remaining 12 and then do something like this:

    So in your example is the enemytype set against the enemy object or the spawnpoint or both?

  • Hey timcs!

    Not a big fan of Wait actions... I'd stick to dop2000 's second solution, having a variable that tells which spawn points were used...

    Cheers!

    Hey brunopalermo would this variable be assigned to the spawnpoint object ? and then if it was true e.g. used then don't use that spawnpoint ?

    ** EDIT **

    I think I have got this to work, my only problem now is that there are 24 spawnpoints and if I specify 12 for each of the objects to repeat over, it does not always pick them all or if I do spawnpoint.count/2 it still misses some out.

    Any ideas the best way to do this ?

  • When do you call the second function? Is it immediately after the first one? Try inserting Wait 0.1 before calling the second one.

    As far as I remember, object instances are not destroyed straight away, it happens on the next tick.

    As another workaround you can add an instance variable SpawnEnabled to your spawnpoint and use it for enabling/disabling spawning at each location.

    Thanks for the reply dop2000, the second one is called after the first had finished via a blank sub event so I will add a wait before hand and try that

  • Hi

    It seems a while since I did this before but I cannot for the life of me remember how. So in my scene or level, I have created spawn points around the area, I then have two other objects which I want to spawn randomly at these spawn points but for the two objects not to spawn at the same place.

    So far my logic is called from the on start layout as a function called "spawnobject1" which does the following :

    System->repeat x times

    System->Pick a random Spawnpoint instance-> Spawnpoint ->spawn object 1 on layer 0 (imagepoint 0)

    Spawnpoint->destroy

    When this has finished from this function I have a blank sub event which calls the second objects function and that does the same as above with that object, however even though I am destroying the spawn point used, the second object stills ends up at the same position as the first

  • dropbox.com/s/qg2hgaxm9rtuoru/bond-eye.capx

    Thanks brunopalermo very helpful

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey timcs!

    Something like this?

    https://www.dropbox.com/s/byq48wyr82f6v ... .capx?dl=0

    Here's the step-by-step:

    1. Put your bg in a layer.

    2. Create another layer over it (mask layer) and set the following layer attributes:

    Transparent: No

    Force own texture: Yes

    3. Create the "eye" sprite (it may have any shape you want) on the mask layer and set Effects>Blend Mode: Destination out.

    4. Move the sprite around using your favorit method. In this example I gave the "eye" sprite a Bullet behavior and added a "Every x seconds" event that randomly chooses the Sprite.Bullet.AngleOfMotion among 360 degrees.

    Hope it helps. Cheers!

    Thanks brunopalermo , for coming back to me, however I do not seem to be able to download your capx as it states that it is not there.

    ** EDIT **

    No need for the capx file now, I just followed your instructions and it looks good ! thanks again, just need to get the behaviour of the moving sprite to work a bit better now.

  • Hi all

    l am looking to create a circle which moves around the game area and when an object appears in its "sights" the play has to click on it if it is the correct type of object.

    My question is how to create this effect ? also the movement of this circle can either be a controlled path or random.

    I hope I have explained this well enough but if I have not think of the 007 intro where bond is walking across the screen and a circle or eye is following him. It is that type of effect

    Thanks

  • Hi again

    I have now figured out what I was doing wrong when reading in the data and writing to it from and to the dictionary and local storage. I have then read the data into a listbox object and used that to hold and allow me to move between records. However if I want to edit an existing record on clicking on an entry from the listbox I can read that into two edit boxes. However once I have changed the data, I worked out how to update the existing entry in the listbox but my problem is then to update the dictionary and localstorage afterwards.

    I noticed that the listbox has a json option and I tried that with the dictionary but this just clears the dictionary meaning to me that the data from the listbox is not held in json format as well.

    Any help on reading this data back would be appreciated

    ** EDIT **

    Worked this out now , ended up clearing the dictionary and re-adding the values updated from the listbox each time the entry was amended.

  • Hi again

    So the main question is, can the built in data objects handle what I am trying to do, as I do not want to try and work this out if they cannot. Sadly I also bought a plugin SQL lite database but this does not work with phonegap so that ended up as a waste of time (and a small amount of money ).

    Please can someone help me with this as it will really help me move forward with this project

timcs's avatar

timcs

Member since 27 May, 2016

None one is following timcs yet!

Trophy Case

  • 8-Year Club
  • Forum Contributor Made 100 posts in the forums
  • RTFM Read the fabulous manual
  • Email Verified

Progress

11/44
How to earn trophies