GeorgeZaharia's Recent Forum Activity

  • try this example let me know if it works for you. it works on my end.

  • When I load my game using the system save/load, I have an event that creates a black tilemap that will fade out.

    So...

    On load complete, create tile map, fade out tilemap.

    This should create the effect of a smooth fade in effect.

    However, there seems to be a single frame where the game is loading before the tilemap is being created.

    So I see the level for a frame, then it goes black, and then it fades away. Rather annoying. Any idea how I might resolve this?

    to me it seems its a event trigger issue or missuse of fadeout, not a tilemap issue... can u replicate the same "condition" in a empty project? and share it? something happens based on what you are saying, that u are triggering the "save" before or after setting the fadeout action so naturally the save function save everything as is at that moment, if ur tilemap is partially fading out, you will see a transparent image when u load or the state the tilemap had as opacity.. it makes sense... if this is the case.

    personally i would save after the tilemap is created... so its in screen at 100% opacity. not after is created and set the fadeout. and give it a "wait 0" or wait above actions to finish. is a C2 trick... not sure if still applies in c3. but usually in C2 we have this issue of actions not taking effect properly cause to many actions are triggered in same tick, and if u get a frame drop... oh well lets say hell goes loose.

    however this is a bit flimsy depending on the save load function to make things work properly.. i would do a workaround and on start of layout create the black image regardless of the save. whenever is loaded or quiting game that image should pop alone like a global event. independent of the save state.

    not sure at this moment if save function affects other "included events" if it doesnt.. that might be a solution do ur black/fade in out screen in a separate event. or layout load that layout first then transition to the new one... is probably not what u want but it's a "patch" as long as it gives the desired result... end user won't care how works behind the scenes.

  • Guess it’s better than nothing. My main complaint is its solution didn’t give something working. You had to modify it a lot.

    At least the formula was probably useful. It basically is a way to move by an angle and it is one of the main uses of trigonometry for games. But then again construct has the move at angle action which could be used instead of the math.

    The problem I see with more complex problems is having to see if the solution is correct. If you have to modify it heavily like removing the angleToRadians expression and such then it’s not helpful.

    But I can see the value of it giving some ideas of where to maybe start.

    yes, thats the whole thing, i think the confusion of the code... is based on how well u ask it things, for example i asked to give me a code to loop create a flower pattern using sprites and it works just copy paste. as long as u follow its steps. however in my 1st cueball test cuestick.. i noticed it mixed some Construct3 parametters in construct2 which is what i tested it on. so im guessing C3 being latest version and more documented might actually a better fit for asking things for it. but i remember early days of me trying to learn and find information in construct forum... dont get me wrong is a great community and source of information, but is so much time consuming to just get a reply while meanwhile, in my case 5 years ago i was sitting idle hopping someone would reply to my question. this thing puts u on a "road" even if slightly wrong, it gives u a direction fast enough so u dont sit idle on the project ur working. to me honestly i wish i had this when i started using Construct 5-6 years ago.

    i did the creation tests and also a Q3D master collection test code review and it actually works... even though it does say wrongly or in lack of information i guess "use the worldXY" the worldXY inQ3D is not defined is just regular XY... we do have a xw but is not implemented or is for something else.

    and yes i did modify it a lot cause my question was wrong... i asked for the cuestick to set its position around cueball... i didnt ask it specifically to use the mouse position as a reference so it didnt knew... later in the same chat i did asked more details like "can u modify it so cuestick follows mouse position while looking at cueball" and then it give me the actual code but again with wrong parameters using radians... which isnt a big problem cause construct just has the angle(xyxy) and i modified a few events "removed them" cause it seems chatgpt doesnt know that u can have multiple actions on the same "everytick condition" + i kept his "set position to cueball" which is redundant since the position gets updated again later on xD

  • So we all been looking around internet lately and heard and read about ChatGPT right? but did you knew? that you can ask him to give you "construct code" snippets ?

    i did a test today. it knows everything about construct plugins, behaviors etc basically the entire manual and what construct is made off... and that made me think... can chatGPT generate construct usable event sheet code snippets? and to my surprise... it did.. somewhat not what i expected but definetly blew my mind... so my test consisted of this

    and then ChatGPT answered with this

    ======================================

    Sure! Here's an example of how you can create a cue stick that follows the cue ball in a circular pattern around the cue ball using Construct 2:

    Create two sprite objects in your Construct 2 project: "CueBall" and "CueStick". Set the origin point of the "CueStick" sprite to the center of the sprite to make rotation easier.

    Place the "CueBall" sprite on the game layout where you want the cue ball to be positioned.

    In the event sheet associated with the "CueStick" sprite, add the following events:

    Event 1: Every tick

    Add an action to set the position of the "CueStick" sprite to the position of the "CueBall" sprite.

    Event 2: Every tick

    Add an action to set the angle of the "CueStick" sprite to the angle between the "CueBall" sprite and the "CueStick" sprite.

    Use the following expression to calculate the angle:

    angle(cueBall.X, cueBall.Y, cueStick.X, cueStick.Y)

    Event 3: Every tick

    Add an action to set the position of the "CueStick" sprite relative to the "CueBall" sprite in a circular pattern.

    Use the following expressions to calculate the position:

    scss

    Copy code

    Note: "radius" is the distance between the cue ball and the cue stick, and "angle" is the current angle between the cue ball and the cue stick.

    Adjust the value of "radius" to control how far the cue stick should be from the cue ball, and test the project. The "CueStick" sprite should now follow the cue ball in a circular pattern around the cue ball.

    Note: The above example assumes that the "angle" variable is in degrees. If you prefer to work with radians, you can use the "radians(angle)" expression instead of "degreesToRadians(angle)" in the calculations.

    Please note that Construct 2 uses a visual programming system, so you can implement the above logic using the available actions, conditions, and expressions in the event sheet, without writing actual code.

    ===============

    initially i tought it will give me some behavior pin to etc type of thing... but this is more usefull than i tought... i wonder now can it do more complex algo and js compatible things? i mean... logically should right?

    what you guys think about this?

    i posted in Open discussion cause i don't know if this is a tool or general discussion or what... but i find it pretty neat that, when we having problems in Construct programming we can ask the community for help but that takes time a lot of it usually... this method would basically solve "small" requests in a instant. or atleast put us on the right path.

    ================

    after i added the mouse plugin so i use the mouse as a direction variable... and tweaked the code generated by chatgpt and the origin point of the questick to match my new element, this is the result the blue line follows my mouse at a 100px distance from abll in a perfect circle around the centered cueball ( redball ) .. if find this amazing, especially for new beginners that need their code to be fixed or maybe ask the ai to generate some better code

    ================

    Tagged:

  • GeorgeZaharia

    what is minus?

    minus like in + 100 and -100

  • im guessing timew is a global? and when u die u reset the global variables. including timew. try reseting globals manually, only what needs to be reset or reset the time after u copy the results in a 2ndary data variable that is local or array etc... that doesnt change when u reset the globals.

  • does ur animation has speed set properly? is there a event looping the start of animation over and over under some condition? this 2 main reasons usually are the faults.

  • ur canvas snapshot doesnt go where the sprite is... it takes the center of the screen or layout... try adjusting the canvassnapshot position if there is a function for it.

    based on ur image.... for canvasX use only bboxleft (or image.X) and for canvasY use only image.y

  • use Minus for force or angle ;)

  • You do not have permission to view this post

  • I'm working on a tower defense game and i had a similar problem needed to know which of the enemy / ai that walk the path is the 1st or last... so i used the bullet behavior, set the speed to random values based on type of enemy, so some enemies are faster some are slower, and at some point if my tower shooting sprite has a target already and a speedy AI passes the 1st current target becoming the 1st target, i need to select that now since is the 1st. Bullet behavior has a "distance traveled" parameter, which counts the pixels they move around. and i used that as my distance calculation to automatically target the first AI whenever gets in front of others. but for you not sure if this is a solution it all depends on how u make the AI move, are they moving grid based? etc

    but a simple solution would be to calculate the left and right distance to the edge of the screen of the AI since that is what u need. to identify which is closest to left or right side ...

    hope it helps.

    to pick an enemy u have to run a for each loop

    and compare the distance => distance(enemy.x,0,viewportleft,0)

    which would calculate the distance of enemy ai to left side of screen or something like that. not sure if the viewportleft is correct code but u should see the proper suggestion in the event sheet if u type it in.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • construct.net/en/free-online-games/pong-3d-39499/play

    Forsted might be able to help u a bit.

GeorgeZaharia's avatar

GeorgeZaharia

Member since 30 Jun, 2014

Twitter
GeorgeZaharia has 35 followers

Trophy Case

  • 10-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • x9
    Popular Game One of your games has over 1,000 players
  • x21
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

21/44
How to earn trophies

Blogs

  • Construct For Dummies - Simple Tutorial Collection

    I scour the Construct forums for users tutorial requests, and create small quick and simple tutorials using Construct's defaults features so anyone can use and apply them.

  • My Dev Logs

    Thinking on games 24/7 is fun and waste of time and unproductive if we don't bring those game ideas to life. In this blog im bringing my game ideas to life and log their development process.