selection box Rts

0 favourites
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • hi there im making a game with a few rts elements in it and i wanna drag a box around my minions ive got it all works but the box looks awful when its stretched is there i way i can get around this?

  • Lol, check out 9patch.

  • thanks for the reply ill give it ago whatever it is , another quick question im making a camera which follows sprite and it moves via me pressing wasd, how do i get it to stop moving when it reaches any of the sides and always keeping sprite centre of screen so when i move in opposite direction it will start immediately?

  • Remove the scroll to behavior, and learn how to use scrollx, and scrolly.

    Research lerp, clamp, and dt, expressions also.

  • ahhh okay, that's doable just thought it might be easier with scroll to

  • newt sorry despite how much i research into it and look at it none of it really makes sense, as to compare the positions you would still need to know the position between middle of screen and the edge but if your changing screen sizes or layout sizes then the middle position would change right ?

    no problems i worked it out im still using scroll to but setting position to scrollx and scrolly so it will always be centre event if camera stops moving

  • i was wondering if someone could help me with this code in image, http://imgur.com/a/wsYPW

    this is using a code from a youtube video tutorial on rts selection box, the problem with the code is he changing the sprites animation which isnt viable for as ive got to many animations to add selection box to and would mess up animations in progress.

    the problem ive got with the code atm is not all demons are being selected unless i drag over them slowly and once they are selected if i decide to make selection box smaller they are all still selected, ive tried a few methods to fix this but nothing is really coming to mind can anyone help me please?

    the selection box is 9patch if that means anything with the edges being tiled and filling being stretched middle of box is transparent

  • Can anyone possible help?

  • Besides that i (personal) think that creating that selection box just to destroy it a little moment later is a big waste.

    The creation process is not that performant and and you will run into a difficult logical flow because of 'cant select a just created object before the next top level event'. Now, that last one you solved in an elegant way, still, it is a fix.

    Just set it visible/invisible when you need it. Doing it that way, you can still check for overlaps after the mouse is released.

    If you insist on that create/destroy process, then you have check for overlaps before you destroy the selection box.

    The selection box is alive in event 420.

    So just add to event 420.

    Pick all Demons

    ...... action ... set selected to false <--- just reset the situation for all

    .......sub event ... Selection box Is Overlapping Demons <---- more performance then the other way

    .............action ... set selected to true

    .............action update something visual so you can see that they are selected

  • 99Instances2Go thank you for replying , i'm happy to set to invisible,

    so maybe

    pick all demons

    if mouse button left down - selected to false

    blank sub event - set selection box to visible

    subevent selection box overlapping demons - set selected to true

    create unit selected demon.x + demon.y

    pin unit selected to demon.x + demon.y

  • 99Instances2Go okay changed quite abit now decided to use the route of creating unit selection boxes on demonspawn and setting variable in box to demon. uid then compare the uids if they match the select or deselect and set visible or invisible based on results, the only problem i have is deselecting units doesn't always work correctly

    as you can see from image of ingame not all the demons are deselecting correctly and not always 100% selecting properly

    any help would be hugely appreciated

    Image of Code

    http://imgur.com/a/ma5xZ

    Image of in Game

    http://imgur.com/a/Mc4bH

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 99Instances2Go thanks a ton gonna try it out now

  • i cant use it lol my version is only 244 steam hasn't updated to 245 lol

  • Up to you.

    Pretty easy to install 2 versions.

    https://www.scirra.com/construct2/releases/r245

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