Heroes4hire's Forum Posts

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • 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

  • set a global variable for centerX

    do you want them to move like a foosball table? one goes right, the other goes with it.

    like a foosball table. 0X000c0X000 00X00c00X00 0000Xc0000X

    striker1.X-centerX= striker2.X C=500 S1=800 S2=800-500=300

    striker1.X-centerX= striker2.X C=500 S1=1000 S2=1000-500=500

    or.. like a mirror? one goes right, the other goes left? X0000c0000X

    centerX*2-striker1.x

    striker2=0 c=500 striker1=1000

    0X000c000X0

    st2=100 c=500 st1=900

    hope i mathed this out ok. i assume striker1 is right of center( as you said he has 100 pixels)

  • youtube.com/watch

    fantastic youtube video about setting up camera for 1st person.

    i was new to 3d in c3, but, this video is so simple i got up to speed on it very quickly.

    tips for you: check out "billboarding" there is a free example in the start page tab on c3. it will rotate objects to camera in a 3d plane.

  • mOOnpunk

    dude, hell yea i watched your clips! honestly, they were a huge inspiration going into this project.

    my sprites still have variables from a kenshi style game i was working on, but i shifted to dungeon keeper after seeing your posts

    maybe i can find a use for detaching limbs in dungeon keeper...

    was thinking on going down a pokemon route, where creatures can evolve

    either way, i see you are still active! and will reference your work if i get a problem!

    my major concern going forward is checking room size. i saw a fill example. that basically filled a set area walled off, within a tilemap.

    did you ever work with tilemaps, and get into doing a "size/area" as dungeon keeper did, to work out room efficiency. what creatures share a bedroom.

    understood it was a few years ago.

  • youtube.com/watch

    just a look at where im at. seeing as you guys are a huge help thought i would add video of progress

    i made the video on mobile... sorry about that.. ill do it more professional when the sprites are in

  • BaconSwagg

    wow wow wow. yup exactly what i was doing, and a great solution!

    if i sense the sprites are causing lag, im defiantly doing as you suggest!

    didnt see your post.. just wackytoasters.. or i wouldnt have spent half a day using sprites...

    at least its working right now. see how well it gets implemented into main game