Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
PokeBrawl (Game for iPad)
-
https://gist.github.com/70b4a6bb0d2a818cb2ce
This is my game :) The basic goal is to collect Pokeballs without getting hit by other Pokemon. The script is pretty massive, but that's mainly because each different Pokemon has a different scripted behavior. Also I am working on compressing the "monsters" array which currently takes up over 100 lines.
Please ignore the messy code and enjoy the game.
<b><u>Features:</u></b>
Twelve types of Pokemon. 21 if you include all evolutions.
Player and enemies can be any of those Pokemon.
Six finished levels.
A 'chat box' which relays information to the player.
Debug buttons.<b><u>How To Play:</u></b>
Collect Pokeballs. Avoid other Pokemon.
If you are hit, and at your lowest evolution, you will die. Otherwise, you will de-volve.
Green blocks can be pushed by the player.
To try different Pokemon Types, use the first Debug button.
<Blockquote> These debug buttons can be found on the top right of the screen, they are the blue boxes. Simply click on them with your finger/stylus and things will happen!</Blockquote>
You need to collect all three Pokeballs in each level to move on.<b><u>Pokemon Behaviors:</u></b>
<b>Kakuna/Beedrill:</b> Chases the player. Beedrill has a larger range.
<b>Charmeleon/Charmander/Charizard:</b> Shoots fireballs at the player. Each evolution has faster fireballs, and Charizard actively chases the player.
<b>Kengiskan</b>: Spawns five Kengiskan babies which follow Kengiskan around.
<b>Kengis Baby/Cubone</b>: If mother dies, babies evolve into Cubone. Cubone throws bones at the player.
<b>Magnetite/Magneton</b>: Electrocutes the player, paralyzing them. Magneton paralyzes longer and has a larger range. Magnetite will only evolve into Magneton if he electrocutes the player enough times.
<b>Nincanda/Ninjask/Shedinja</b>: When Nincanda evolves, he splits into Ninjask and Shedinja. All three of them use a string shot to pull the player towards them. Nincanda does only one string shot at a time, Ninjask does two, and Shedinja does three.
<b>Sandshrew/Sandslash</b>: Once evolved, Sandslash will randomly curl up into a ball (Defense Curl), possibly blocking the players path.
<b>Entei</b>: He's incomplete. Right now he just faces the player.
<b>Zubat</b>: The 'weakest' Pokemon, Zubat very slowly flees from the player.
<b>Espeon</b>: The opposite of Zubat, Espeon is psychically attracted to the player.
<b>Golem</b>: Golem sometimes curls up into a ball and begins rolling around at the fastest speeds of any pokemon. Because of this, he sometimes runs through walls and level designs need to keep this in mind.
<b>Kingdra</b>: Moves 2x the speed of other Pokemon, making this one very dangerous.<b><u>Character Behaviors:</u></b>
<b>Charmeleon/Charmander/Charizard</b>: The player can shoot fireballs in a straight line by tapping the screen. Fireballs will kill anything except a Sandslash using Defense Curl. Evolves by hitting a pokemon with a fireball.
<b>Sandshrew/Sandslash</b>: Evolves with a high probability. Once Sandslash, the player can click on his/her sprite and Sandslash will curl into a ball, becoming invincible but immobile. DEBUG TIP: If you force the evolution even higher, then you can walk while being a ball, a great way to test levels without having to worry about monsters.
<b>Magnetite/Magneton</b>: Periodically spawns Magnetite friendly pokemon which circle around the player, with a limit of five. If it gets two Magnetites, there's a chance it will evolve into Magneton. Also, Magnetites work as a 'shield' - if they hit another pokemon, they will die instead of you.
<b>Nincanda/Ninjask/Shedinja</b>: Evolves with a medium probability. Once Nincana evolves, he splits into Ninjask and Shedinja. Ninjask remains player-controlled. Shedinja follows Ninjask around, and will kill any enemy pokemon it hits.
<b>Kakuna/Beedrill</b>: Evolves with a high probability.<b><u>Debug tools:</b></u>
<Blockquote>Button 1: Change Pokemon Type (currently, this is the only way to try different pokemon)
Button 2: Force Evolution (can be used to make Sandslash invincible, or to increase speed or Charizards fireballs to ridiculous amounts.)
Button 3: Change Level
Button 4: Kill all monsters on level
</Blockquote><b><u>Known Bugs:</b></u>
If you have ran the 'sprite walk' code posted on these forums before, you may need to change the name of 'soldier2.png' on line 513 to something else.
Golem sometimes gets stuck in a wall and will glitch through the other side.
There is no 'Hard reset' for the game, you have to restart the entire project to reset the game data.
Beedrill may chase the player through walls if the walls are thin enough, as seen in the "Tic Tac Toe" level.
If you push the green blocks against Pokemon in a corner, they will get stuck in the block and might glitch through it. -
Wow! This is a really awesome game so far! I'm looking forward to playing it more, and to future releases! Also is great inspiration for me to keep going with learning pythonista (not that I needed any, but it never hurts).
As you mentioned, there are some bugs:
- there is a "pokemon" (reachable through the debug menu) that constantly flashes through varius sprites (pokeball, masterball, rock, bone, etc.). It is called "unknown". Not really sure if this is a bug or just a placeholder.
- when you play as shedninja (as in you press nincada's evolution button multiple times) the game crashes when you touch another pokemon. Not sure if the bug is the crashing (not sure if the AI shedninja does the same thing) or if the fact I'm playing as shedninja is the bug:P
Also, "soldier2.png" is actually located on line 503, not 513. I'm sure that is just a typo. I changed mine to "soldier3.png".
Again, great game and I'm looking forward to seeing it more! I'll post anymore bugs I find.
Thanks,
Cubbarooney -
Thank you Cubbarooney for the information :)
Yes, that pokemon you mentioned (called Unknown) is just a placeholder. The only reason it even shows up at all is because I allow the debug button to turn the pokemon type to '0' instead of '1' when it loops around. Easy fix :) But eventually I plan on removing the debug buttons entirely and have the player's pokemon type be automatically determined for each level.
As for playing as Shedinja, you're not technically supposed to be able to become Shedinja. If you don't force evolution using debug buttons, and start the game as Nincanda, you will only evolve once and you will in fact become Ninjask. Shedinja is supposed to spawn as a 'friendly helper' for the player and is actually never directly controlled by the player. I never really thought to try playing as Shedinja so I can see why it might cause a crash.
I will look into ways to fix these glitches, they seem pretty small issues. I'm so happy you enjoyed the game!
-
If you wanted, you could add a picture of the Pokemon "Unknown" to "Unknown" just as a teaser :P That way if someone who chose Unknown would get a bit of a laugh out of it!
Oh, and I was wrong, I changed it to "Soldier1.png".
Also, I've noticed that Beedrill (and others who actively chase you) are not the most commited at their job. They tend to give up about half way. They eventually chase you again and are still annoying in numbers nonetheless. Maybe it's just me.The Pokemon type be automatically being chosen is a good idea (in my opinion). That way you can't depend on one strategy! I would recomend limiting the amount of playable Pokemon to six. It just makes it seem more "real", if you know what I mean.
If you wanted to add a Pokemon, I'd recommend Oddish. It is the classic grass/poison combo, containing two types you so far lack. Also, Oddish has a split evolution track, which might be a fun game element. The last reason is really the only reason I chose Oddish; there are plenty of other great Pokemon to choose from (like Mudkip!).It seems to me that you aren't much of a fan of Gen IV and Gen V. I say this because the highest Gen Pokemon are from Hoenn. Not that I really care (Gen III was my first, and Gen IV is so far my last. HG was best the best game from Gen IV), just an observation.
One last thing, how did you learn to use the various modules? Did you just use the included information with the app, or did you use an external tutorial? I'm new to all this and would love help from someone who knows what they are doing.
Thanks,
CubbarooneyP.S. If you'd like any help I'd glad to be of assistance. Not sure if that means much though, considering how much code I know. But I'm learning :D Then again, code isn't everything.
-
It's funny you mention that, but I do have Unknown sprites built into the game's sprite sheet (see http://i766.photobucket.com/albums/xx303/TurtleSoupguild/iPadGame_Sprites2-3.png) I was planning on having them pop up in the game. Perhaps as a bonus?
Also great idea about having only 6 playable Pokemon for the player. In fact, if it's set up right, the game could be played like you're a trainer battling with your six pokemon. If you lose a life - you lose a pokemon. And the game's over when all six pokemon faint :D This might mean you can pick a pokemon for each level from your available party. It's something that could be done (relatively easily in fact) and might tie this into the Gameboy games better!
Oddish is an interesting Pokemon, especially if I use grass bushes in the game. It would be funny if some of those 'grass bushes' rise and attack the player with a sleep spore. Surprise attack! The only problem I see with this is the need for more sprites, so I will search for those and see what I can find. So far I have been using sprites some gamers ripped from Pokemon Mystery Dungeon, I remember seeing Oddish.
"It seems to me that you aren't much of a fan of Gen IV and Gen V." I was raised on the Gen I Pokemon, so I have a special love for the originals and I understand them better. I do enjoy the newer generations, especially the dark types. Many of the sprites were just mandatory selections - I needed a sprite with a full walk cycle that could also have some unique behavior.
Last, the directions of Beedrill/Kakuna.. Beedrill and Kakuna have a range they are activated, and a closer range they 'turn off'. So if the player comes near them, what usually happens is: Beedrill/Kakuna rush to get near the player, then stop once they are close enough and return to their normal random walk pattern. This forces them into a confrontational zone. If you would like to try slight variations of that to see what Beedrill and Kakuna might behave with closer ranges, go to lines 698-702 and play with the values. If you really want to see a pokemon give chase, try standing next to Charmeleons until they reach the final evolution. Then run for your life.
If you want to help out that would be great. One thing I need to work on is how to compress the code. 1000 lines of code is really a challenge even for me to navigate easily - and I know where everything is.
I learned everything mainly through examples posted on these forums and what's built into the documentation. Also I have been very familiar with the random module for a long time now. The math module was only necessary for Magnetite's rotations around the player.
-
Hey Eliksam i forgot to just post how awesome this is, thanks, im learning a heap load from this
-
Yes, 1000 lines of code is a lot! I'll read through it (for real this time :P) and see what I find. I'll learn some things and maybe compress a thing or two here!
Yikes, you're right... Charmeleons and their family tree are quite scary. Beedrill too, if you set the min to 0 (which I did, and he didn't give up easily). I did find a possible bug. The openings in the Tic-Tak-Toe level are very small and the Pokemon have trouble getting through it sometimes (I find the player's Pokemon has a less of a problem with it).
I'm glad you like my 6 Pokemon max idea :) If you wanted it to be like the Ranger games you could do seven, but that would be a bit strange :P
Oddish for sure is in the first MD game and I think he is in the second as well. Also, you may want to use the HG/SS sprites, considering they have sprites for all Pokemon through Gen IV. Sadly, I don't think they took size into consideration... Nonetheless it is a good fail safe.
On that note, Gen V Pokemon can't be used as of yet. If I recall, the next MD is Pokemon Ranch style sprites, so I doubt you'll be able to use them :/ Not that I truely care, Gen V is my least favorite Gen (Pokemon wise. The region looks amazing and the mechanics seem to be good... But the Pokemon?)
Anyway, going to read some code now!
Thanks for the help,
Cubbarooney -
@Dalorbi - You're welcome :) I'm glad you like the game haha it's kinda messy. I am working on another game right now which should hopefully end up with many less lines of code. And as I work on this one I plan on making it simpler to read so keep an eye on this thread!
@Cubbarooney - "I did find a possible bug. The openings in the Tic-Tak-Toe level are very small and the Pokemon have trouble getting through it sometimes (I find the player's Pokemon has a less of a problem with it)."
Actually, the doorways in that level are a special collision tile that's mainly used to keep the player safe in his spawn zone. The player can walk through the tile but the monsters cannot. In the Tic-Tac-Toe level, the doorways are blocked to keep the pokemon in their respective boxes. The idea behind that level is to force the player to walk next to a group of pokemon so they can see why they're powerful in groups :D And if you kill too many Pokemon it makes the last Pokeball nearly impossible to get.
Beedrill (due to his max range) can sometimes walk through the walls on that level when he's chasing the player.. I will need to work on that since it shouldn't happen.
Those walls the player can walk through but the monsters cannot is used often in the level designs. For example, the level I call the 'powerplant' (the one with all the nincanda and magnetites in three boxes)
-
After that post I did go back and looked at it again. This time, I noticed that the "boxes" are indeed different colored (a slightly greyer color) than the rest of the feild! My, those collision boxes sure are useful :)
Also, after oh-so-many years of playing Pokemon I just realized that the Pokemon Unown does not have a "k" in its name!
Win some, lose some.Also, did you come up with the loadimage() command or did someone else? I find it very useful (if you need a picture from a website that is).
Thanks,
Cubbarooney -
Well the loadImage function itself I made using the coding made in this Spritesheet Animations script (actually this script was what inspired my game originally):
http://omz-software.com/pythonista/forums/discussion/77/spritesheet-animations
https://gist.github.com/C0deH4cker/20403fcfab8cbb3bbf5a -
It isn't much, but it does cut about ten lines...
<pre>#24-36
GOAL,KAKUNA,KINGDRA,ZUBAT,EKANS,ESPEON,CHAR,NINJ,SAND,ENTEI,KENGIS,MAGNET,GOLEM=0,1,2,3,4,5,6,7,8,9,10,11,12</pre>I'll let you know if I find anything else. Also, if you'd rather let me pm you these "edits" just let me know!
Cubbarooney
-
Nice I didn't think about doing that haha!
Yeah 10 lines is a big difference IMHO and every shortening counts (as long as it doesn't destroy readability).
I already compressed the Levels array (it used to take up 4x the space) and I can do the same to the Monsters array but I haven't been inspired lately. I have been working on a space game. And I'm already over 300 lines with NO graphics!!! Gahh..
I think I need to practice methods for shortening code during loops!
Thanks again for your help Cubbarooney. Posting here is fine and might show newbies some nice tricks for Python programming (and shortening syntax hehe)
-
Considering that is what I am, it works :P
I'm glad that helped, and I'll see what I can do in the future. If you still want notes for those constants, just add it below/above the line. I'm sure you figured that out :D
And a space game? Yay! I love space games. I've already found two, but three is a charm!!! I even changed one of their graphics to the Galaga ship. Wait, is a space shooter or something else?
Well, back to code,
CubbarooneyEdit: just noticed you posted it :P