wrapping a map

Game Editor comments and discussion.

wrapping a map

Postby Mardi-Gras » Sat Feb 18, 2006 2:10 pm

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.
User avatar
Mardi-Gras
 
Posts: 57
Joined: Sun Jan 22, 2006 10:10 pm
Location: Glenrothes, Scotland
Score: 0 Give a positive score

Postby Troodon » Sat Feb 18, 2006 2:45 pm

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?
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Mardi-Gras » Sat Feb 18, 2006 2:50 pm

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. :D
User avatar
Mardi-Gras
 
Posts: 57
Joined: Sun Jan 22, 2006 10:10 pm
Location: Glenrothes, Scotland
Score: 0 Give a positive score

Postby Troodon » Sat Feb 18, 2006 2:53 pm

Try to make some transport actors.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Mardi-Gras » Sat Feb 18, 2006 3:07 pm

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. :D
User avatar
Mardi-Gras
 
Posts: 57
Joined: Sun Jan 22, 2006 10:10 pm
Location: Glenrothes, Scotland
Score: 0 Give a positive score

Postby Troodon » Sat Feb 18, 2006 3:12 pm

heh :)
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Troodon » Sun Feb 19, 2006 4:21 pm

What kind of game are you making? Could you take a snapshot? :D
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Mardi-Gras » Tue Feb 21, 2006 5:43 pm

It's a remake of the game "Feud", TekDino - just as an exercise, not for commercial purposes. It looks a bit like this:

Image

Cheers again for your help.
User avatar
Mardi-Gras
 
Posts: 57
Joined: Sun Jan 22, 2006 10:10 pm
Location: Glenrothes, Scotland
Score: 0 Give a positive score

Postby Troodon » Tue Feb 21, 2006 5:45 pm

Oh yes! I remember your game! You were asking how to stop the wizard from trembling with the trees. The game looks cool!
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Mardi-Gras » Tue Feb 21, 2006 5:57 pm

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. :D
User avatar
Mardi-Gras
 
Posts: 57
Joined: Sun Jan 22, 2006 10:10 pm
Location: Glenrothes, Scotland
Score: 0 Give a positive score

Postby ericdg » Sat Mar 04, 2006 3:46 am

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.
ericdg
 
Posts: 53
Joined: Tue Nov 29, 2005 1:18 pm
Score: 1 Give a positive score

Postby Mardi-Gras » Sat Mar 04, 2006 11:39 am

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.
User avatar
Mardi-Gras
 
Posts: 57
Joined: Sun Jan 22, 2006 10:10 pm
Location: Glenrothes, Scotland
Score: 0 Give a positive score

Postby frodo » Wed Mar 22, 2006 2:38 am

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 :)
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score

Postby Fuzzy » Sun Mar 26, 2006 1:35 am

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;
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest