Heroes4hire's Forum Posts

  • yeah, ok. i hope i see what you want.

    box to follow the hoard (who is in the library. and to stay middle of the hoard. so when some leave, they are removed from the hoard.

    cos(B-C):\cos(C-A):\cos(A-B)

    one way of getting the centre of 3 points (triangle)

    but, thats just one way.... i think its the best, as it doesnt care what type of triangle it it

    omnicalculator.com/math/centroid

    (this website has a ton of math that you could try)

    Gₓ = (x₁ + x₂ + x₃ +... + xk) / k

    Gᵧ = (y₁ + y₂ + y₃ +... + yk) / k K is the number of zombies. G is center point

    this is the simplist i could find to get a center point for more zombies.

    so, that should find a mid point constanly between all zombies within a hoard.

    wow this takes all my time. i pray this works and i understood what you needed lol

  • yeah, on created, you need to give it a uidcheck variable. the uidcheck is for an instance of a zombie's uid. most likley the leader.

    then it always knows what instance of zombie it is specifically acting to.

    *edit* or.. is that the problem, its always choosing the same zombie, and you dont want it to choose any?

    is it you want it to set a midpoint for all zombies?

  • i have the layout scroll out with the mouse wheel.

    the hud doesnt scroll to this layout.

    sure its simple fix, but, great if i can get an answer so i can implement it tomorrow.

    ty all

  • ah yeah, i meant array. i used dictionary to store names on picked up objects.

    just seems like an hour of clicking and adding 1 to each event. but, if that is the best way im down to do it,

    ty

  • so. i want to store 30 names. then i want to call a random name on a creature spawned

    i could use dictionary and insert a name line by line. then random(1,30) on the x axis.

    but.. is that the most efficient way?

    could i use clipboard, local storage, file system: to achieve this easier?

    none of which i have experience on. so if i get the nod ill work on the favorable method.

    thanks

    Tagged:

  • ok so. heres the code i use to work out the mid point between 2 objects

    hoard.x+radius*((zombie.x-hoard.x)/sqrt((zombie.X-hoard.X)^2+(zombie.Y-hoard.Y)^2))

    that will give you x

    hoard.Y+radius*((zombie.Y-hoard.Y)/sqrt((zombie.X-hoard.X)^2+(zombie.Y-hoard.Y)^2))

    that will give you Y

    it basicly assumes the hoard box center is the mid point. then zombies will pathfind to a circumference in a circle around it based on where they are.

    you could give the zombies a IV for its own radius ( distance to the center on the hoard square) and adjust it randomly

    then, im thinking have them use 8D to always head to that point. as the hoard moves, they will move with it.

    hope its of use!

  • BaconSwagg yeah, i knew it may be in issue. its why i set the radius as a GV. maybe it just needs playing around with the figure. i tried a little, too small and they cant target the block, too big, and they can target further blocks.

    the blocks are 96x96 : radius should be 48! and that should barely let them get to the block... yet on 16, it seemed to be the perfect figure.

    i may go back to the drawing board at all on it... trying to rule out using raycasting with barely any experience on it.

    maybe i could give the blocks pathfinding... they wont move, but if they can find a path, the imps can target it.

    either way, the conversation on it helps me think, so its appreciated

  • honestly, the pathfinding will get you there. but. to constantly recalculate the path will cause lag with so many instances.

    using 8 direction will help more imo. you can just simulate movement to the point you want.

    im going out. more thoughts later

  • BaconSwagg

    youtube.com/watch

    code:

    for each impbase:

    is not boolean working

    is not boolean targetted

    pick become tile, become tile dig=1

    becometile. pick nearest imp base.

    (so if the imps dont have a job, they arent currently moving to something, and the tile is selected to be dug)

    becometile.x+radius*((impbase.x-becometile.x)/sqrt((impbase.X-becometile.X)^2+(impbase.Y-becometile.Y)^2))

    impbase.Uidcheck: set to become tile UID

    set boolean working true

    set boolean targetted true.

    the path finding code is explained in the video. i had another topic where i explain it. but, it just checks the center point of the tile, and calculates the closest point on the circumfrance to the imp.

    on arrived. impcheckuid>0 set digging boolean true.

    then the dig code is just do an animation based on a timer. and do damage to the becometile that has UID= impbase.uid check.

    just want to add, in the video, the imps stop when they cant reach the block to dig. they will continue to do other jobs when unselecting the block.

    priority is to drop off gold they have when full. dig, and then claim ground

  • ':D yeah, thought i may be shooting in the dark on a 5 year ago project.

    with lionz help i found out about families. been 6 years since i used that.

    but using families and a GV uid check i can pick up individual objects.

    1 more question, sorry bud.

    imps are digging tiles 1 behind the front line. they wont unless its the only option.

    it only happens occasionally. but, its a bug, maybe you faced?

    im using, pick nearest, find path. but despite it being an unreachable route, they do it anyway.

    are you still making c3 games?

  • i have a global variable, that calls the pick up items uid.

    instead of pick nearest, it just sets 1 value on click. worked for overlapping imps. should now work for overlapping familymembers.

    then i can just call the "pick up" conditions on a specific item that uid=GV:uidcheck

    *edit* yup works perfectly. family solved all my problems, legend bro

  • lionz

    yup, perfect advice. didnt think of that. massive thanks as always

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • lionz

    sounds simple enough. ill have to push gold away from imps when they are in the same x,y.

    buuut... can i pick nearest for 2 different objects? i can pick nearest imp, or i can pick nearest gold. hmm.. maybe with compare 2 values and distance. ill give it a go. not sure how it will work with multiple imps.

    i have a selector thats the size of a tile (96x96). i could try and break that up to 5 points, so when you drop something it picks a place in order. fun.

    always run into a problem at the end of coding something.

  • yo mOOnpunk

    you did picking up imps and placing them.

    1, you had awesome drop animation how did you achieve it?

    2, did you ever have difforent things to pick up? like gold?

    3, did you ever deal with overlapping objects that react to being clicked?

    nearly nailed the pick up system. but, im stuck with picking up gold and an imp at the same time... at least i organized it so i can use the same playerbase for monsters and imps if needed.

  • *edit2* simplify the request:

    imp. and gold. both can be picked up on click.

    but if they overlap, it picks up both at the same time.

    any idea on how to choose 1 thing?

    dungeon keeper had a highlight on what was selected.. no idea where to begin, its late.

    any help appreciated. helps me think when i try on it tomorrow. on click im setting a global variable to the clicked objects uid.

    thanks all