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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

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

Sorry. How to guarding against a nil enemy? I am really noob

raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

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

Code: Select all

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

ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

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

Oh. I was try it before making this topic. It make enemy undead! I don't know why.

ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

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

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.

raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

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

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.

zorg
Party member
Posts: 3005
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

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.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

pgimeno
Party member
Posts: 2340
Joined: Sun Oct 18, 2015 2:58 pm

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

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.

ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

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

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.

ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

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

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.

ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

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

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?

### Who is online

Users browsing this forum: Google [Bot] and 68 guests