I'm currently studying Python and pygame, trying to make a sample simulation for a shooting game.
Usually, when dealing with a missile or bullet projection, I heard using list is the most common way to control the movement.
like
missile = []
missile1X = fighterx + fighterWidth
missile1Y = fightery + fighterHeight / 2
missile.append([missile1X, missile1Y])
I'm trying to put additional information about a bullet like 'kind of weapons', but only to have a result of
ValueError: too many values to unpack(expected 2).
This is what I was trying to do: adding more information on elements of the list, I want to change the kind of weapons that fighters use.
The code below is what I thought would work...
missile1 = pygame.image.load('missile1.png')
missile2 = pygame.image.load('missile2.png')
missileX = 100
missileY = 100
if weapon_num % 2 == 1:
missile = missile1
if weapon_num % 2 == 0:
missile = missile2
missileXY.append([missile1X, missile1Y, missile])
Question is,
Would it be possible to put additional one like above?
Is there any other way to execute what I want?
Any other caution I might face?