GeorgeZaharia's Forum Posts

  • thanks for the detailed explanation and demo! Although this method has some limitations comparing to tween behaviors, it's definitely useful.

    This formula appears to be similar to "easind Out" tween function, can it be modified to simulate "easing In"? (slow at the beginning, gets faster at the end)

    that can happen if you decrease the / number while dividing it so you start with a division by 100 let's say, and then every 0.01 subtract 1 from that 100 and the reversed incremental should appear like that "easing in". -Edited: scratch that ... im working on it, the distance adding is automatically doing its own easing out effect cause the distance is always shrinking, so what would make sense after a surtain number the distance to be at a surtain number that creates the illusion of fastening up. its definitely doable but im not sure if distance would work for the reversed effect.

    Honestly i never used the tween plugin didn't found it useful for my own, it's definitely a interesting plugin and helps a lot of people just i think it's an extra dependency that is not really needed once you know C2 expressions. i guess for desktop targeted games wont cause problems the plugin itself but some compilers for mobile will probably have issues with it, if not now in future for sure, unless it's updated by the dev.

  • atmas here is version 2 with the expression i was talking about the manual alternative to notequal is "<>" so its kinda of working however there's plenty inside there that i hope you will understand i didn't spent any time to comment it. if you need that let me know. dont mind the LOS behavior is still attached but not used, i only used pathfinder to make the objects move towards some direction and some extra identifiers with their own identifiers as instance variables, there is a 40 pixel jump backwards when they see the collision which makes them get out the field of view and then reenables the points hope you can adapt any of this to your project and possible solves your problem. .... even this since is not perfected and done in a rush still fails some times.

    the extra red dot might not be needed, and you could actually pick the same AI using distance by comparing " <>" UIDS of objects. that i will definetly do in morning. Good night!

    Edited: the "<>" is a operator not expression but hope it made sense.

  • I tried to use the L.O.S behaviour, so each AI car would know each other and would avoid crashing one into another, but this won't work. I'm saying that because when i use the L.O.S behaviour in the AI cars to detect the player that is in another layer above, it works 100%. What can i do to fix this? Thank you man!!!

    L.O.S is line of sight which basically uses some sort of distance(x1,y1,x2,y2) but most of times it breaks when used with pathfinder together, so my advice would be to drop L.O.S and use the expression " if distance(car.x,car.y,car.x,car.y) less or equal then 100 car stop (at this point you made your own L.O.S without the behavior and without the problems of L.O.S and Pathfinding behaviors). now i know it might seem obfuscating from our point of reading the code, but C2 actually has a background system that when you appoint the car.x, same time, basically what does, for each car that detects another instance of the same car object it applies that. you might need to add for each loop while using it. but should work, i used it on a aquarium type of game and AI ( AI used same name no numbers picking or other tricks just pure "aifish" for all different types of fishes.)worked awesome they were hunting each other and the player no confusion whatsoever in code. so that being said, i think it might work for you also. Hope you can understand my spaghetti code from above and the explanation.

    Edited: ehm.... i forgot i did used a identifier i used their frames numbers. but i dont think that would help in your case let me check something il get back to you.

    Edited 2: so i made this capx its not working perfect, but LOS seems to do the job pretty good here, i think the old bug is not a problem anymore, however distance it seems here is a bit frustrating to work with i can crack this when my head's clear. 11:36 pm here been up for all day, the thing with AI in general you have to code each side of car and and make it aware of its surroundings even if the cars are the same object basically, it's IID or UID picking but i can't find the expression sign for not equal so i can add it in it's some weird C2 advanced expression(not the not equal in the normal dropdown). il post in morning more for sure. i really want to fix this one, bugs my brain if not. if you're in a hurry you could try AI cars he has a template that has AI s racing each other and their avoiding each other however is a very complex system he has there with a lot of custom plugins if im not mistaken. (at Rex sorry for summoning you.)

  • atmas why use overlapping points for a pretty intensive graphic game? i would've used "distance again" (i know dop2000 ) because its less heavy on systems logic. using overlapping points of images the computer or system has to measure each pixel in each frame and see if they are colliding. you could use bbox left right top bottom of the car and target imagepoint.x,y and measure the distance if distance is a surtain safety number car stops. you will notice with this approach a 50% to 90% cpu usage drop, depending on your project how heavy is from graphic point of view.

  • how random must it be?

    you can do int(random(1,5)) or use choose(1,2,3,4,5,6,7) , then convert the number in a string text and play from sounds/music folder and you place str(yourvalue) in there.

    then you need to build on the number picked what audio you want to play, or have the files named like that and tell the audio to play that file using the set source i think expression or play from folder... been a while since i used it. there's different approaches let me see what i can do in 2 minutes.

    Edited: yiuyiu6666 i think 2 minutes past ... my bad if was more than 2 here is a random audio capx

  • Hi guys, i'm having this weird problem;

    I'm making an object spawn every x seconds. and it bullets to the left.

    On created, set animation to: "choose ("1","2","3","4")

    the object spawns 1 & 2 spawn perfectly, they bullet to the left. but 3 & 4 spawn and bullet to the right.

    How can it be that animations inside the same object are set in different bullet speed/direction without any programming of it?

    im pretty sure (90%) you have a image point problem. if 1 and 2 are spawning correctly then your 3 and 4 have the wrong image point position unless their centered on all frames and animations and then is a logic problem in your code.

  • I don't get it..

    If initial score=500 and I want to add 20, then distance(score,0,rewardedtobeadded,0)/10=48

    What should I do with this number?

    let me do a capx il edit here ! better to show then tell.. i know the math sounds weird but works from what i tested on other projects using that "formula" for easy incrementals.

    Edited (2 minutes later) : as promised now the division is value "20" not "10"... "10" was what i used for movement but is basically the same formula.

    The so called "formula" it's actually a sort of a no sort of a % comparison of the two numbers no matter what the number is... the increment is always going to be accurate. it's either how is supposed to work or is a C2 glitch... however this is how i always used it... if it's going to change in any update soon... i want to keep this C2 version lol. makes life easier.

    i hope it's helpful and you ( sublimate or who might need it) cut off the extra plugins that might cause problems in mobile compilations. im pretty sure this method works with C3 also as long as you have the expressions there. capx incremental number using distance

    to get the exact ease-in incremental just increase the divided" %" or the value "20" to "30" or "40".

    extra perk "no custom plugins" and works with any number.

    known issues, you might need an boolean/variable/trigger /condition whatever you might call it, to detect when the increment is happening so you dont double time reward if you multi click it(thats if will be triggered by click). if it's only triggered at end of round or achievement or reward for destroying something or collecting some coins then there is no need for extra conditions just copy paste it(make sure you got the global variables in your capx when you transfer and add the "trigger one time" properly).

    sublimate check the capx above maybe is a better alternative for what you want.

  • I understand you want to animate your scores?

    I made a small demo:

    Tween Demo

    CAPX

    you could achieve the same thing with distance(score,0,rewardedtobeadded,0)/10 i think.

  • It's top linear, no physics. I just need it to go a short distance, it works fine when dragging at a normal pace but if the player drags as fast as possible it often breaks the game. I'll try out your suggestions, is it right to assume this is done with Custom Movement?

    not necessarily, but usually that is how i use it. if you have a default movement, just use the same (distance(x1,y1,x2,y2)+(60*dt))/10 as speed. and should work. the number "10" that i used to divide the distance, can be anything you want depending on your wanted results. lower then 10 is faster higher then 10 movement will lag a bit...

    here is an example of the dt distance movement. 1st group is for a following pet/ etc 2nd is direct movement while your mouse/touch is down. this way it never breaks atleast i didn't managed to break it even if i were going bananas on mouse speed. hope this is what you needed.

    i used the same movement in this demo here

    however it has a mistake or lack of events in code, you need to add a "is not tapping" or " is not clicking" condition type so it happens only when dragging happens. other way youl find yourself with a small bug that on tap /click movement will start happening because of the distance being bigger then 0 .... now number 0 can be anything you want, that is your center point limit.

  • You do not have permission to view this post

  • add (60*dt) or lerp(a,b,measure) to the drag force? it all depends how your dragging happens... is it physics based? or top linear?

    usually i use distance(x1,y1,x2,y2)+(60*dt) that gives a delayed dragged and a quick one when is in short distance. but not sure if is the desired movement you want.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Pathfinding might be as important as you want it to be. Meaning depends if that would be the core of your movement or not.

    Im intrigued by this type of AI cause is a complex one, you have so many things to tackle and take in consideration. but definitely you're four cardinals suggestion is the way to go, however its not only 4 ways of moving its 16 i think if we exponentially grow the possible positions to move on, cause you have to make the AI become smart a bit so it can decide to go close to the player and try "hunt him down?" or just build its superpowers and then go for a hunt? thats why im intrigued by this AI is bloody amazing and complicated all those variables.

  • you can import any video and use the video plugin .h264 to play it. no need to convert it.

    However when you play videos using the .h264 you need to take in calculation the platform users will use and if that platform is compatible with the codec and the video format. for example playing webm files wont be compatible with safari and apple devices. jus stick to mp4 files or avi

    if the files are to big, just reduce the bitrate of the video in a video editor (Premiere for example.) usually a min 1Mbps/2Mbps Max bitrate video is usually enough for majority of files, keeping the video quality intact and frame rate( unless you are trying to use some 4k or 1080p complex video then quality is noticeable. When i say complex i mean lots of stuff going on in it. if the video is a simple video, like a man talking with no action in background or 1 object moving with not much of environmental lights moving around, then your safe reducing the bitrate.)

    example of same file with reduced bitrate 1-2 MBps bitrate 1080p quality same in this one being a simple video ... white background 1 colored character around moving. if we where to add some crazy lights then frame rate would skip and pixelation would be a lot more noticeable. <- size 20Mb

    original file at 10-12 Mbps full 1080p <- size 40 Mb

    but this is a .mp4 example .avi has more weight... the .mov files are as close as light as a webm just they dont play well with devices unless you got quicktime installed. .webm files are mostly incompatible with some of the apple devices as mentioned above.

    size of the same video above on all formats would be around :

    .webm 10-20 mb -noticeable behavior of .webm files played in firefox... they are flipped on vertical axes for some reason and sometimes take 1 to 2 seconds to start playing.

    .mp4 20-40 mb

    .avi 100-200 mb

    .mov 40-80 mb

  • Hi there,

    Do margins serve two purposes? These purposes being the space around the project space and how the viewport moves with scroll to?

    just the space around editor layout i dont think it affects scrolling at all.

  • in theory yes, keep in mind that Teams fusion is more of a construct classic type of engine, some math calculation might need adjustments on C2.

    for example in C2 we dont have anymore X("player") we have player.x which is more logically correct.

    but yes should work. look at the tutorials section above in the forum menu pretty sure youl find some capx examples.

    check this tutorial

    in addition to that, you might try this plugins which will help you a lot considering a isometric game isn't something simple to do. (helpful plugins for grid movement games.)

    or you might want to actually follow the C2 isometric tutorial

    Subscribe to Construct videos now