![]() |
||||||||||||||
|
||||||||||||||
blade2k
» articles & tutorialsPicture Mapping
So there's never enough room in a chipset for everything you want in your map, right? Well, any big parts that are meant to be over the hero such as the roofs of houses or treetops or whatever can be replaced with pictures, freeing up space in your chipset for other stuff. Obviously the first thing you'll need to do is make the picture, use Idraw or MSPaint, whatever you usually do. The problem is making the pic appear in the correct spot regardless of where the hero is on the map. Here's how: Make a parallel process event. You'll need 6 variables, I'll call them HeroX, HeroY, PX, PY, MaxX, and MaxY Set MaxX and MaxY to the respective size of your map, (i.e in a 50x50 map they'd both be 50) Set MaxX-11 Set MaxY-7 Set HeroX = Hero X-coordinate Set HeroY = Hero Y-coordinate Fork HeroX < 9 Set HeroX = 9 End Fork Fork HeroX > MaxX Set HeroX = MaxX End Fork Fork HeroY < 7 Set HeroY = 7 End Fork Fork HeroY > MaxY Set HeroY = MaxY End Fork Set PX = Event X-coordinate Set PY = Event Y-coordinate (This event will be where the pic is centred on, not necessarily the parallel process one. You could directly designate this position without using an event, but I like to use an event to make it easier to move if necessary.) Set HeroX - PX Set HeroY - PY Set HeroX * 16 Set HeroY * 16 Set PX = 152 Set PY = 120 Set PX - HeroX Set PY - HeroY (Here you can fine tune the position of the pic if it's off centre (adjust PX and/or PY by plus or minus a few pixels), though it's probably better to fix the actual pic's size to centre it properly.) Show Picture at coordinates PX and PY, making sure to check the "move with map" box. You can then repeat this sequentially for all the pics using the same variables, but changing the PX/PY variables designation to a different event's coordinates (unless you want two pictures in the same place of course.) You'll also need to change the picture number for each one. After all the pics are positioned you can either turn off the parallel process event with a switch, or simply put this in at the end (recommended): Label 1 Wait 100 seconds Go to Label 1 Or if you want the pic to move around with the event it's centred on, add this afterwards: (Yes it's mostly the same code.) Label 1 Set HeroX = Hero X-coordinate Set HeroY = Hero Y-coordinate Fork HeroX < 9 Set HeroX = 9 End Fork Fork HeroX > MaxX Set HeroX = MaxX End Fork Fork HeroY < 7 Set HeroY = 7 End Fork Fork HeroY > MaxY Set HeroY = MaxY End Fork Set PX = Event X-coordinate Set PY = Event Y-coordinate Set HeroX - PX Set HeroY - PY Set HeroX * 16 Set HeroY * 16 Set PX = 152 Set PY = 120 Set PX - HeroX Set PY - HeroY MOVE Picture to coordinates PX and PY, making sure to check the "move with map" box, and the "wait until done" box, the time setting will vary depending on how fast you want it. Go to Label 1 Once again you'll need to code for each event/pic separately and sequentially within the Label/GotoLabel loop, but DO NOT check the "wait until done" box on the move pic commands except for the very last one. That should do it. You can also use this technique to make some nice lighting effects or set a pic of a flame on ripple and burn the city down, or whatever else you can think of, the applications are pretty much endless. |
|
|||||||||||||
|
©2002-2008 blade2k.net - parsed in 0.002 seconds - view active users
[16401 members][newest member: magicalkittie]
|
||||||||||||||