0

I recently (5 weeks ago) started my first school year in an school based apprenticeship to become an IT assistant.

We're learning programming and are starting with very basic processing things, while the ultimate plan is to get into C#.

Now I understand that processing might not be the best language for my little project but I still would like to work this out somehow.

What I want to build is a "Stargate Dial Computer". If you know the TV Show you'll know what I'm talking about.

I wanted to make it visually appealing so I decided to use one of the available tools to create my shapes as I am using a DHD (term from the show) for the dial process - see picture: https://i.stack.imgur.com/6JiX6.png

This small shape setup already is over 500 lines of code and that seems unwise in itself. Besides that, the plan is to have every single of these trapezoids be a pushable button - but to achieve that manually I'd have to check their coordinates against the mouse collision to utilize them as buttons.

What I'm asking for now is any input on how to work with these shapes in a logical way to make my Idea even possible.

Something like, checking for the shape's color instead of the shape's coordinates itself like 40 times and getting the "active" shape's size in some kind of function. Or a way to just get every shape one by one in a loop, checking for every beginShape and endShape instance if that wouldn't be a performance nightmare.

Keep in mind that I am a beginner. I do know the basics, also of other languages, and I can apply some programming logic here and there - but since I'm not sure what processing can and can't do (yet) I'm looking for an answer to the question if this is even reasonable or possible, or not.

Any help and ideas would be much appreciated!

Thanks!

  • How much do you like math? Every time I see a question like this one, the answer ends up a variant of "use math", which translates here to "how would you calculate, from the mouse click's coordinates, if one of the buttons has been clicked?". If object oriented programming is an option, this could be fairly easy, but after 5 weeks you are probably using procedural programming? Here's my advice: if you can turn this problem into math, it'll suddenly become easy. Whatever you do, copying-and-pasting an answer would maybe work right now, but not help you in the long run. – laancelot Sep 08 '21 at 16:00
  • Hey thanks for the reply! I'm not necessarily looking for the perfect code as an answer, just more like "what would be the approach that would work" then I would try and figure it out myself. But it at least seems like it would be possible :D – ThePatchelist Sep 08 '21 at 20:53
  • I can suggest older posts which will put you on the right track. [Here's how to catch a click and compare it to coordinates](https://stackoverflow.com/questions/64409591/click-image-to-make-sound-play-processing/64409685#64409685). [Similar idea, with more buttons](https://stackoverflow.com/questions/61461285/main-menu-with-switch-statement/61493452#61493452). [Same again, but using a finite state machine](https://stackoverflow.com/questions/65012168/how-to-clear-canvas-and-buttons-and-their-functuality-after-clicking-a-button/65015528#65015528). – laancelot Sep 08 '21 at 21:14
  • If you want to use a shape different from a square, you may want to brush up your high school geometry and re-read how to verify if a specific point is inside a polygon. And then apply this knowledge to this problem: of you know if the click is inside the polygon, then you can react accordingly. – laancelot Sep 08 '21 at 21:16
  • Thanks a lot, this will help me find my way! :) – ThePatchelist Sep 08 '21 at 21:25

0 Answers0