Re: help with walls (python) please?

2020-08-22 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: help with walls (python) please? @15It's actually more readable than the alternative if you're a mathematician, because it matches exactly how math resources write ranges.  But I don't use it because I program in multiple programming languages and it's just not w

Re: help with walls (python) please?

2020-08-22 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
Re: help with walls (python) please? That "if x in range(min, max)" thing is kinda brilliant. Yes, it is woefully inefficient and you should use "if x>min and xSince I'd generally be using Pygame for something or other, I'd generally use pygame.rect for 2d col

Re: help with walls (python) please?

2020-08-22 Thread AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
Re: help with walls (python) please? @13That's awesome! Did not know that. Thanks. Shame it's less readable than the normal way. URL: https://forum.audiogames.net/post/563557/#p563557 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu

Re: help with walls (python) please?

2020-08-21 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
Re: help with walls (python) please? Right. will deffinately try and make use of it. thanx once again. URL: https://forum.audiogames.net/post/563298/#p563298 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin

Re: help with walls (python) please?

2020-08-21 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: help with walls (python) please? @12The correct way is x >= min and x < max, which works in any programming language.  Python also lets you do min <= x < max, though you don't often see that form and it's a Python specific feature. URL: https://forum.audi

Re: help with walls (python) please?

2020-08-21 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
Re: help with walls (python) please? Ok, i will try thi sout and let you all know. thanx all for the help.The reason why i was using the range, is because i googled how to check if a variable is between 2 variables... and it gave me the range function. i wanted to make sure that if the

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
Re: help with walls (python) please? As an aside, for loops can be written as:for wall in walls:    if wall.colides(x, y):        breakelse:    print('No wall.') URL: https://forum.audiogames.net/post/562943/#p562943 -- Audiogames-reflector mailing list Audiogames

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: help with walls (python) please? @9See this, section 3.3, if you want to know how this sort of overloading works. I don't want to derail this thread more to give a full explanation, but it's relatively simple to overload the in operator, as well as all the other operators and

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: help with walls (python) please? I see. Thank you. Learned something new today. URL: https://forum.audiogames.net/post/562823/#p562823 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: help with walls (python) please? @7it's being used with a for loop, not an if statement.There's a difference between in in a for loop, and in in literally any other context in Python.  In literally any other context in Python, in is the in operator.  In a for loop, in is ma

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: help with walls (python) please? @camlorn, how do you explain this?#globals.py x = 2 #test.py import globals print(globals.x) #Prints 2 for globals.x in range(10, 20): pass print(globals.x) #Prints 19 URL: https://forum.audiogames.net/post/562807/#p562807 -- Audiogames

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: help with walls (python) please? @4I think the range thing actually works. Python will only bind variables as part of a for loop. Otherwise in is just a normal operator.  The shell suggests that it does what they think.  Still a bad idea though, and I'd not at all be surpris

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: help with walls (python) please? Firstly, a more performant (as in by a *lot*) way to do range checks is just if x >= min and x < max.Secondly, because you're only correcting x by 1 if the player is inside the wall, if the player is 2 units inside the wall, it'll have

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: help with walls (python) please? I think your main problem is that you misunderstand how range is supposed to be used.if you type range(1, 10), you will get numbers between 1 and 9.If you type for x in range(1, 10) and your x is already declared, it gets overwritten with the last value

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
Re: help with walls (python) please? Ok, what i want to do is move the player around, between spawned walls. So if the player hits for example the left wall, he doesn't stay trapped in walls, that's why i move him one step back. i know i probably should include facing... but i wi

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
Re: help with walls (python) please? Ok, what i want to do is move the player around, between spawned walls. So if the player hits for example the left wall, he doesn't stay trapped in walls, that's why i move him one step back. i know i probably should include facing... but i wi

Re: help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: help with walls (python) please? You need to tell us what you're trying to do, and also what isn't working.I immediately see that you're trying to correct x after what is presumably the player is inside the wall. What you should do instead is check whether the player

help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
help with walls (python) please? Hi all, i am trying to make a wall class so that there are boundries on the map that a player can't pass. i am so sorry for being stupid or some thing lol, but i've tried googling this, but no luck at all. I've had more luck with the string_c

help with walls (python) please?

2020-08-19 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
help with walls (python) please? Hi all, i am trying to make a wall class so that there are boundries on the map that a player can't pass. i am so sorry for being stupid or some thing lol, but i've tried googling this, but no luck at all. I've had more luck with the string_c