Hey there! I’ve been working on recreating the classic game, Breakout. As I’ve been working on it, I started working with creating the properties for the ball such that it would stick to the walls, could be aimed, and fired again. With this, I’ve run into some issues;
Creating a dashed line for the aim assist. Creating a dashed line has proven difficult, because when I successfully create it, it lags my computer out due to being so hard on the computer.
Having the line follow the mouse, but go beyond the mouse to the edges of the walls. Using mouseX allows the line to stop/follow the mouse, but I want it to go beyond the mouse. Any ideas, i have the angle for atan down but can’t figure out how to make it go further then the mouse.
Finally, creating a mousePressed() function that once pressed, “shoots” the ball towards the direction. I assume once I can create my line through the mouse, it would just inputting the angle into the speed variable to have it move that direction.
I created a function for mouse pressed and made the line extend. I used a PVector to create an angle between the mouse and the ball, and a variable called stuck to keep track of whether the ball is stuck to the wall or not. The code:
Also remember to hit ctrl-t in processing prior to posting and in the forum mark the entire code with the mouse and click the </> sign in the command bar
@Naeloob Wow works great! Thank you so much, I’ve never used PVectors yet nor been taught them so I’m glad you were able to help me. @Chrisir Noted, I’ll make sure too from now on.
Does anyone have a solution for the dashed line? I still can’t seem to make one out that would function properly