2022-01-30 13:24:18

@24
Creating lists of lists like [[]]*10 can cause referencing errors, lists need to be initialized with immutable elements, otherwise they end up referencing only a single list. This is touched on [here] and [here]. Some could consider it more pythonic to initialize an array with just loops, though if its really an issue you could just use Numpy and initialize a matrix array in a single line.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

Thumbs up

2022-01-30 15:44:23 (edited by bhanuponguru 2022-01-30 15:44:53)

actually, i'm like intermediat /  advance pythoneer. any method will bee good for me. but i did not notice this little thing in my gerny lol.

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

Thumbs up

2022-01-30 18:39:45

yeah, you can only multiply for the inner lists.  It's a nice shorthand, but I guess maybe not newbie friendly or something.  The actual evaluation of it is:

1.  Evaluate the list of one item.
2. Copy the list n times, with the already evaluated value.

So if the thing in the list is a reference type then you've got a list of references to the same thing because what's in the list is references.  But that's fine for tiles, because with tiles you are presumably not mutating them all the time.

In any case I'll just add that the BGT tutorials aren't very good.  If you're willing to read sighted game programming guides you can get more info than those by a lot.  The real problem is that people assume audiogames are different when actually they're sighted games but we just don't add the graphics code.

My Blog
Twitter: @ajhicks1992

2022-01-31 03:57:35

@28
aa it makes sence why python does that.

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

Thumbs up

2022-02-01 16:23:40

https://github.com/chrisnorman7/game_map_examples

Take care,
Chris Norman
Selling my soul to andertons.co.uk since 2012.

2022-02-01 20:30:28

Thanks Chrisnorman, I will take a look at your examples, they will be very useful to me.
I still wanted to thank everyone for your kindness.

Thumbs up

2022-02-04 10:01:41

Is it better to loop y or x first when generating a map?
The way i did it it ends up looking funny when you print out the array, x is the row and y became the columns.

x = 5
y = 10
map = []

for i in range(x):
    l = []
    for j in range(y):
        l.append(i+j)
    map.append(l)
End of Post!
Leos signing off.

Thumbs up

2022-02-04 10:24:38

@32
It ultimately doesn't matter as long as its internally consistent and gives your desired result. In geometry and graphics X is typically associated with horizontal, or row, and Y is associated with height, or column. In your given example however, you do the reverse. I would suggest reversing the two, but its up to you.

for i in range(y):
    map.append = []
    for j in range(x):
        map[i].append(i+j)
-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

Thumbs up

2022-02-04 15:26:52

magurp244 wrote:

@32
It ultimately doesn't matter as long as its internally consistent and gives your desired result. In geometry and graphics X is typically associated with horizontal, or row, and Y is associated with height, or column. In your given example however, you do the reverse. I would suggest reversing the two, but its up to you.

for i in range(y):
    map.append = []
    for j in range(x):
        map[i].append(i+j)

So to call them from the array, i use map[y][x] instead of map[x][y] if i use your example?

End of Post!
Leos signing off.

Thumbs up

2022-02-04 15:31:40

@34
I kind of want to suggest that you may wish to try more basic programming, and find some Python books to work through.  If you're having this much trouble with simple 2D arrays, you're probably not ready to tackle a game yet.

My Blog
Twitter: @ajhicks1992

2022-02-04 16:08:07

@34
i too suggest the same because you need more practice over 2d arrays to really understand what's going on.

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

Thumbs up

2022-02-04 18:21:42

Please read post 18. I literally explain why this happens. I also third the programming books suggestion.

Thumbs up

2022-02-04 23:43:49 (edited by magurp244 2022-02-05 00:31:24)

@34
Yes, you'd use map[y][x], or map[column][row]. Like moving up and down a book shelf, then side to side finding your desired literature. Each empty list you add, adds another shelf, each element you add to that new list increases the length of that shelf.

map = []
for a in range(0,5,1):
    map.append([1,1,1,1,1])

In this example, it adds 5 filled rows to a single list. So map[0][x] to map[4][x] would move up/down along each row, and map[y][0] to map[y][4] would move left/right along each item in the selected row.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

Thumbs up

2022-02-05 04:53:32

hello all: Which source in the synthizer should we use for footsteps? and Which one  for ambience sounds?
I tried source3D for ambient sounds and do not know how it works
And direct Source is  for music
pleas help me, thanks

Thumbs up

2022-02-05 05:01:27

I document Source3D probably as well as it can be documented in the docs with the Python repo, as well as in the manual.  If that's not sufficient to help you out, I'm not sure what is.  You use Source3D by setting the position of the source and the listener.

My Blog
Twitter: @ajhicks1992

2022-02-05 06:38:19

@39
Your questions depend on a few things, such as whose footsteps? The players or someone else's? How do you define "ambience"? Points of sound you hear around you? Or just general music/mood sounds that have no particular direction? 3D sounds operate by having the listener "hear" the sounds near or around them, so if you position the sound where the listener can't hear it, you get no sound.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

Thumbs up