Page 1 of 1
wrapping a map
Posted:
Sat Feb 18, 2006 2:10 pm
by Mardi-Gras
I'm attempting to wrap a map horizontally - that is, as the player walks to the "edge" of the right-hand side of the map, the left hand side of the map appears, and the player continues into that side of the map, and vice versa of the player is walking to the left edge of the map. The player object is the parent of the view, and I've tried this global code:
if (x > 320) x-=320;
(My screen width being 320).
This doesn't appear to work, and I'm really puzzled as to how to resolve this. Any suggestions as to how to create map wrapping would be hugely appreciated. Many thanks.
Posted:
Sat Feb 18, 2006 2:45 pm
by Troodon
Is your map the same size as the view?
Have you tried to do corner actors wich puts the actor to the other side of map?
Posted:
Sat Feb 18, 2006 2:50 pm
by Mardi-Gras
The map is not the same size as the view - it is very much smaller than the view (it's a big map). But there are only two points at which the player can move off the map (so to speak), where the map would actually wrap, so I could put actors in those two locations that switch the player's position.
Many thanks for the advice, I shall give that a go.
Posted:
Sat Feb 18, 2006 2:53 pm
by Troodon
Try to make some transport actors.
Posted:
Sat Feb 18, 2006 3:07 pm
by Mardi-Gras
Transport actors - very good! Tried it, and it works like a charm. Thank you very much Tekdino, I wouldn't have thought of that solution.
Posted:
Sat Feb 18, 2006 3:12 pm
by Troodon
heh
Posted:
Sun Feb 19, 2006 4:21 pm
by Troodon
What kind of game are you making? Could you take a snapshot?
Posted:
Tue Feb 21, 2006 5:43 pm
by Mardi-Gras
It's a remake of the game "Feud", TekDino - just as an exercise, not for commercial purposes. It looks a bit like this:
Cheers again for your help.
Posted:
Tue Feb 21, 2006 5:45 pm
by Troodon
Oh yes! I remember your game! You were asking how to stop the wizard from trembling with the trees. The game looks cool!
Posted:
Tue Feb 21, 2006 5:57 pm
by Mardi-Gras
If you're interested in replaying the original game, a java applet of it can be found at:
http://www.worldofspectrum.org/infoseek ... .zip&emu=3
The version I am making is different in that the map scrolls about the player rather than page flips, and that the player is called "Nick" - me - and the enemy is called "Matt" - my closest friend. He's always wanted to be able to throw fireballs, and I've always wanted to see him attacked by zombies.
Feud fulfills both those wishes.
Posted:
Sat Mar 04, 2006 3:46 am
by ericdg
If an actor had a certain amount of xvelocity, when you moved the actor to the other side of the screen, would the actor still have this velocity.
The velocity would not be called by a draw actor event, but rather by pushing a button to get the actor moving, then releasing the button and the actor continues moving. Would he still continue moving the same direction and velocity if moved to the other side of the screen.
Posted:
Sat Mar 04, 2006 11:39 am
by Mardi-Gras
Yes - using Tekdino's suggestion of a transport actor as the event trigger to move my player object from one side of the map to the other, the x-velocity and the direction of the player object was maintained after the move.
Posted:
Wed Mar 22, 2006 2:38 am
by frodo
This should move the actor to the other side of the screen:
int w = view.width/2 + width;
int h = view.height/2 + height;
if(x > w) x = -w;
if( y > h) y = -h;
if(x < -w) x = w;
if(y < -h) y = h;
I think I am understanding your question :)
Posted:
Sun Mar 26, 2006 1:35 am
by Fuzzy
you can also use my Integer Modulus function.
int imod(int A, int B){return (int)A%B;}
use it like so imod(bignumber, Limit);
so imod(555,320); results in 235.
imod(320,320) would put you at 0;