• Advertisement
Sign in to follow this  

Pacman using Java Swing, how to go about painting my tilemap?

This topic is 773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone!

 

We've been assign voluntary task of creating pac man at school.

 

So far I've been able to get myself quite far with only a little bit of googling (Had to look up stuff about tilemaps, while i was thinking in terms of 2d array I sort of wasn't able to collect my thoughts well enough)

 

So far what I have:

 

  • Tilemap made of walls and paths
  • Yellow circle representing pacman - collision works 
  • 4 red dots representhing the ghosts which currently move randomly, step over each other, though i got the collison to work

 

  • I still plan on including the dots that are eaten by pacman
  • Improve the AI so that it will atleast attempt to follow the player (not really sure if my idea will work 100%)
  • sound FX

 

What I'm currently totally at loss is texturizing the tiles. My tiles are 20x20 pixels so i guess the texture for invidual tiles would also have to be this size. However I'm not very experienced with Java and I have no idea how would I implement texturing in swing, i guess I'll need to use Graphics  2d (currently using just the graphics library)

 

So if you could point me in the right direction that'd be great!

Thanks!

 

I also attach the prototype I have so far.

Share this post


Link to post
Share on other sites
Advertisement

You could read some of the docs located at https://docs.oracle.com/javase/tutorial/2d/images/index.html

 

You could just use the same tile 20 times, this would probably be loaded once anyways, and you would overlay the little dots that pacman will be going after, and it would just be a matter of checking collision and then removing the dot.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement