Page 2 of 3

Re: The big problem with loops running at the same time, about destroying objects and asking about how loops work

Posted: Mon Oct 07, 2019 5:09 am
by ilovelove2019
Sorry. How to guarding against a nil enemy? I am really noob :(

Re: The big problem with loops running at the same time, about destroying objects and asking about how loops work

Posted: Mon Oct 07, 2019 6:51 am
by raidho36

Code: Select all

if enemy ~= nil then
This is the same as "if enemy then" because everything except nil and false resolves to true.

Re: The big problem with loops running at the same time, about destroying objects and asking about how loops work

Posted: Mon Oct 07, 2019 7:25 am
by ilovelove2019
Oh. I was try it before making this topic. It make enemy undead! I don't know why.

Re: The big problem with loops running at the same time, about destroying objects and asking about how loops work

Posted: Mon Oct 07, 2019 7:38 am
by ilovelove2019
Besides, I have a question. Do not know how you and other professionals have trained to get the results today. I really like game programming. I came to it despite many things that prevented me. I came across a lot of tools and languages ​​but I didn't study anywhere and didn't get any results. I have come across many tutorials on making games, it's just the basics, the simple games, I think I learned it. They seem to be trying to hide a key. Can you help me? What is your way to learn programming? How do I go? I want to understand structures. I want to have a game with good algorithms at the standard level, about managing objects, levels, transitions, storage, ... a lot of things. I have no idea where to look for it. May people love me and teach me wholeheartedly to help me improve. I am really dissatisfied with my current level. My code looks bad. I wasted time wasted without any progress. May everyone help me, point out a specific path about what a game programmer needs to learn to become talented people like you. I sincerely thank.

Re: The big problem with loops running at the same time, about destroying objects and asking about how loops work

Posted: Mon Oct 07, 2019 8:32 am
by raidho36
Short answer is "don't worry about it". You'll gradually improve over time, you don't need to put any specific conscious effort towards it (mainly because it's a cognitive skill so you improve by radically changing it and not by refining & reinforcing it). Don't expect any quick success though, it usually takes years.

One basic advice I could offer is to use flowcharts. Design your program on paper, then implement it in code. Also math (particularly trigonometry and linear algebra) will be useful for making games.

Re: The big problem with loops running at the same time, about destroying objects and asking about how loops work

Posted: Mon Oct 07, 2019 8:53 am
by zorg
Also keep a dummy around that you can bounce ideas off of, verbally; programmers usually use a rubber duck for such things, but just about anything works, from matryoshka dolls to anime figures.

Re: The big problem with loops running at the same time, about destroying objects and asking about how loops work

Posted: Mon Oct 07, 2019 9:24 am
by pgimeno
ilovelove2019 wrote: Mon Oct 07, 2019 7:25 am Oh. I was try it before making this topic. It make enemy undead! I don't know why.
What do you mean by undead? The frog was destroyed and deleted from the array. It can't possibly come back.

Re: The big problem with loops running at the same time, about destroying objects and asking about how loops work

Posted: Mon Oct 07, 2019 12:31 pm
by ilovelove2019
Sorry for the delay, I am trying to respond gradually to everyone :(. I just had an accident this afternoon and my hand is quite sore.

Re: The big problem with loops running at the same time, about destroying objects and asking about how loops work

Posted: Mon Oct 07, 2019 12:50 pm
by ilovelove2019
Thank you Zorg and Raidho36. That was really a motivation for me. But it would be better if I knew specifically what to learn in order to manage a complex game. Like game state, game loop, how to make an inventory system, ... I don't need instructions to be written for Love2d but I need the basic guide for the game in general. I read a lot of good people code and I find they have a very complex system that makes their games effective and easy to add new features and objects when they need it. As for me, it is very bad, every time I add a feature, I almost have to refactor almost the entire code because I encounter a lot of bugs due to the method, the general structure for my entire game is too poor and not at all logic at all. I will always try, but my quality is very poor, if there is no specific direction I will fail quickly. I'm so sorry for bothering you. But that is really my heart.

Re: The big problem with loops running at the same time, about destroying objects and asking about how loops work

Posted: Mon Oct 07, 2019 12:53 pm
by ilovelove2019
pgimeno wrote: Mon Oct 07, 2019 9:24 am
ilovelove2019 wrote: Mon Oct 07, 2019 7:25 am Oh. I was try it before making this topic. It make enemy undead! I don't know why.
What do you mean by undead? The frog was destroyed and deleted from the array. It can't possibly come back.
I mean if I use guard. When I threw the cherry bombs at the frogs, they didn't take any damage. The code after putting into guard it does not work. I do not understand why?