Charas-Project

Game Creation => Requests => Tutorials => Topic started by: the_game_guy on August 07, 2008, 02:42:29 AM

Title: An easier way to show picture in your game!!
Post by: the_game_guy on August 07, 2008, 02:42:29 AM
This helps me out in way for my platformer game called Platformer Nightmare. I need to show lives so it show the number above my characters head. Anyways Say if you want a number above a characters head, input this coding, oh and you'll need this picture. Just include the attachment in your game.
Code: [Select]
Start of with a loop like this
loop
<>
repeat loop
Code: [Select]
Now enter this for the rest of the code
Loop
Wait 0.1 sec
VarOper::[xxxx::Hero X] = Hero X Coordinate
VarOper::[xxxx::Hero Y] = Hero Y Coordinate
ShowPicture 1[whatever you named the attachment] [xxxxHero X] [xxxxHero Y

Now this won't work because the map tiles are 16x16 so we must multiply the hero x and y by 16.

Code: [Select]
So enter this instead
Loop
Wait 0.1 sec
VarOper::[xxxx::Hero X] = Hero X Coordinate
VarOper::[xxxx::Hero Y] = Hero Y Coordinate
VarOper::[xxxx::Hero X] * 16
VarOper::[xxxx::Hero Y] * 16
ShowPicture 1[whatever you named the attachment] [xxxxHero X] [xxxxHero Y]

Now test it out and you'll see its on the hero, well kind of off to the side because of the picture, so we want it directly on the hero so enter this

Code: [Select]
So enter this
Loop
Wait 0.1 sec
VarOper::[xxxx::Hero X] = Hero X Coordinate
VarOper::[xxxx::Hero Y] = Hero Y Coordinate
VarOper::[xxxx::Hero X] * 16
VarOper::[xxxx::Hero Y] * 16
VarOper::[xxxx::Hero X] + 8
ShowPicture 1[whatever you named the attachment] [xxxxHero X] [xxxxHero Y]

Now it should be directly on the player. Now lets position it above his head. Do take note that this will only work for this picture to put it over his head. With other pictures you'll have to experiment a little but enter this now.

Code: [Select]
So enter this
Loop
Wait 0.1 sec
VarOper::[xxxx::Hero X] = Hero X Coordinate
VarOper::[xxxx::Hero Y] = Hero Y Coordinate
VarOper::[xxxx::Hero X] * 16
VarOper::[xxxx::Hero Y] * 16
VarOper::[xxxx::Hero X] + 8
VarOper::[xxxx::Hero Y] - 16
ShowPicture 1[whatever you named the attachment] [xxxxHero X] [xxxxHero Y]

Now make sure the event is a parellel process and now the picture should be above his head even when you walk. Ok but for a simple pictures display say you want
a picture show X=10 and Y=10 so now take a variable [xxxx::X] * 16 and [xxxx::Y] * 16 and show the picture on these variables. This tutorial was made by me I am not sure if there are any ones like it and I wanted like I said earlier life amount display so this way you don't need to keep entering random numbers to show a picture. I found online that rpg maker 2003 tiles are 16x16 so I made a little algorithm equasion that does the work for you. You may need to subtract 8-16 from Y or X. If you want the picture to go directly into the center of the square multiply it by 8 instead of 16. I did make this tutorial and if you want to post this tutorial for your site please post made by the_game_guy. Same with my jumping system I made thank you!! Remember this enters the numbers for pictures so you don't have to.