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
================