Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image shown when player walks over an object

 
Cristian Malmros
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, hello!

I'm developing a little game at school together with a small group. I'm responsible for graphics but because of deadlines I'll also have to help coding a little now. I'm a total beginner and what I need to do right now for our 2D platform game is to make an image (.png) appear when the player stands at a specific location. I have managed to get images to be shown in-game (with lots of help) but I really have no idea how this should be done.

This is the code to display an image that we've used. Our game is called mimic and here I've placed a sign in the world. I want the text to appear when the player stands at the sign:

mimic.addAnimation("sign_info_",1,true);
mimic.addAnimation("sign_info_",1,false);
mimic.setX(650);
mimic.setY(979);
mimics.add(mimic);

If anyone could help me out I'd be very grateful!
 
Mich Robinson
Ranch Hand
Posts: 260
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just see if the player (x,y) position is within a certain range of the position you want. If it is then display the image else don't display the image. I'd suggest making the range a constant across the app so you can increase or decrease it as required.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic