How to create lvl for single objects

0 favourites
  • 15 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Good Day,

    im trying to create lvls for the same sprite but for different spawned objects (tower defence, tower levels)

    I created smth like, on click on hud (sprite) spawn another object (tower sprite) and place it. when click on sprite example twice update the single object on another lvl. I’ve created different booleans - lvl 1/2/3 etc. and on click on tower set boolean to 1/2/3...

    The Problem is it seem like all the main sprites beeng updated to. But I just want the single Tower to beeng upgraded. I hope it’s understandable. Can’t show the sheets, i’m not on my computer atm.

    another question is, do I need to set different global variables to every level and tower or is there another way to easily set different conditions - like tower damage/health etc..

  • Not easy to understand, needs a better explanation really. The tower health etc would be done with instance variables on the object instead of global variables.

  • Okay, here we go again.

    I want to create a Tower Defence game.

    In this game you´ll need Towers and u will need to upgrade them to another level. When I upgrade my placed Tower, all the Towers (who use the same sprite) will be updated to. I just want to update 1 of the placed Towers and not all Towers.

    another Example:

    When I creat another Sprite - every Tower is using. Tower number1, and another placed Tower number2, the third placed Tower number3 - but every placed Tower is using the same sprite. I just want to upgrade Tower number1. The rest of all the 3 placed Towers (number2 and number3) shouldnt upgrade to.

    I tried with boolean - when touch tower number1 = set upgrade1 and some conditions to "upgrade1".

    And I tried with instance variable - when touch tower number1 = set instance variable "upgrade" from 0 to 1. If instance variable "upgrade" is set to 1 then do all the conditions I want to. The Problem is all Tower´s means Tower number1, number2 and number3 getting upgradet if I touch only on Tower number1 to change the boolean or instance variable. I hope its understandable now. Sorry for bad english.

  • Do you mean tower 1 2 and 3 are the levels of upgrade or are tower 1 2 and 3 different types of towers? You shouldn't have a problem with this because if you say tower 1 touched - change variable, it should only affect the tower being touched, not pick all of them.

    Edit: Ok I see your screenshot now, it would make it easier if you did 'on object tapped', the hold gesture will pick all towers.

  • Do you mean tower 1 2 and 3 are the levels of upgrade or are tower 1 2 and 3 different types of towers? You shouldn't have a problem with this because if you say tower 1 touched - change variable, it should only affect the tower being touched, not pick all of them.

    I mean tower 1, 2 and 3 are diffrent types of towers. But all tower are created by the same sprite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah i see it now, see my edit above. The hold gesture just picks all tower=1, but if you do on tower touched, it will only change the one touched, or is that a problem for the gameplay? I guess use 'is holding over object'.

  • Yeah i see it now, see my edit above. The hold gesture just picks all tower=1, but if you do on tower touched, it will only change the one touched, or is that a problem for the gameplay? I guess use 'is holding over object'.

    No its not a Problem for the gameplay.

    I just tried it right now, it still not working.

    Now it´s allready activated when I place my towers. But still for all towers.

    Edit: I dont know if the problem is cause of the Mouse condition. I still need to edit it to touch. But I guess it shouldnt be a problem.

  • You'll have to share the actual c3 file at this point, it's a bit convoluted now with the addition of the build mechanic, tough to really know what's going on. Looks like you can apply upgrades why you are building if the variable normal is set to 1 by default.

  • Here is my C3 file.

    Its a little bit older version and is buggy to.

    I just deleted my last day work cause of it doesnt worked and bugged much more.

  • Well the first problem you have is a bug where when you create a turret you 'spawn' one but also the turret created as part of the build tool is placed, so you create 2 turrets every time. That needs resolving first. Also when you create a turret its already upgraded because you are 'touching' it when you create it.

  • Well the first problem you have is a bug where when you create a turret you 'spawn' one but also the turret created as part of the build tool is placed, so you create 2 turrets every time. That needs resolving first. Also when you create a turret its already upgraded because you are 'touching' it when you create it.

    Now I´ve cleared the Event sheet and removed some bugs.

    But still the same problem. All towers are shooting when set 1 to upgrade :/

    (dropbox link is the same, like in reply befor)

    If you want to try it, (hold mouse on purple sprite to open menu and double click on tower to open upgrade menu)

    Edit: I think its cause I always use the same gun to shoot. It should be work if I creat another gun.

    But I got another Problem, do u know how to fix the mouse part to touch part?

    It doesnt worked with on touch object, instead of mouse. Also tried hold touch and touched object.

    Re Edit: Still doesnt work. I created a new gun and placed on its old place. I have no idea how to fix it :X

  • From what I can work out, those upgrade sprites don't relate to the turrets. For levels of upgrade you should be using an instance variable on the turret and setting it to 1,2 or 3 etc. Then you say if turret.variable=1 make it do such a thing. If you're using a menu to do this fair enough, but you cannot then reference that menu later on as though it relates to the turret.

    When you select the turret you need to identify it with some ID variable as the one picked, then when the menu option is chosen, it picks the turret with that ID and sets the upgrade variable to 1,2 or 3.

  • From what I can work out, those upgrade sprites don't relate to the turrets. For levels of upgrade you should be using an instance variable on the turret and setting it to 1,2 or 3 etc. Then you say if turret.variable=1 make it do such a thing. If you're using a menu to do this fair enough, but you cannot then reference that menu later on as though it relates to the turret.

    When you select the turret you need to identify it with some ID variable as the one picked, then when the menu option is chosen, it picks the turret with that ID and sets the upgrade variable to 1,2 or 3.

    The last think you said, with idenditfy with some ID, is what im trying since hours. But I still not find a solution to identify every single turret I creat on the layer. It always set every created Turret to the same ID.

    Please show me with a picture how you would do this. Maybe im to stupid to find the solution :X

  • In its basic form something like, on touched turret, set a global variable to turret.UID

    Then the last selected turret can be picked from this value.

    On upgrade 1 selected, pick turret where UID = global variable, set turret.variable to 1

  • --- Solved ----

    As you told I needed to add the sprite id. I was able to add the sprite ID with

    "sprite.iid" and get the expression with pick "sprite.iid"

    Thank you plinkie :)

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