Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (OptimusPrime, AndrewAMD), 14,580 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
2d tile-based game - map problem #283772
08/10/09 00:11
08/10/09 00:11
Joined: Aug 2009
Posts: 26
Goiânia - Brazil
D
dmBlack Offline OP
Newbie
dmBlack  Offline OP
Newbie
D

Joined: Aug 2009
Posts: 26
Goiânia - Brazil
Hail,

This is my first post... a need a little help or suggestion if possible:

I am working on a 2d tile based game. There is a function that picks up the current character position (x axis) and check if it is greater than 800 (currente resolution is 800x600), if so a new file (txt) is opened (or was supposed to) depending on a certain parameter with the map information.

The tiles are panels created during runtime. Perhaps this is where the problem happens.

When I test run my script, the engine simple stop responding. At a certain point, it has also displayed a "Too many shift_map() - functions" message......

I´ve checked the function alone, without testing for the parameter given a certain character position and it works (as if the current map loaded where always the starting map).

If I don´t make any sense either on my explanation or my english sorry.... anyway I´ll try harder during this week.... sunday is gone!!

eek

Re: 2d tile-based game - map problem [Re: dmBlack] #283775
08/10/09 00:26
08/10/09 00:26
Joined: Jul 2008
Posts: 170
Germany, near Mainz
Nicotin Offline
Member
Nicotin  Offline
Member

Joined: Jul 2008
Posts: 170
Germany, near Mainz
So you call a function as soon as the character is over 800? like
if(character.x > 800)
{
shift_map();
}
?



Re: 2d tile-based game - map problem [Re: Nicotin] #283778
08/10/09 01:11
08/10/09 01:11
Joined: Aug 2009
Posts: 26
Goiânia - Brazil
D
dmBlack Offline OP
Newbie
dmBlack  Offline OP
Newbie
D

Joined: Aug 2009
Posts: 26
Goiânia - Brazil
Yes... after solving this problem I plan to do the north/south transition also.... and the relative transition (after checking if character.x is greater than 800 it will also check wich is the current map).... for now I am stuck...

Re: 2d tile-based game - map problem [Re: dmBlack] #283801
08/10/09 07:55
08/10/09 07:55
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
Quote:
When I test run my script, the engine simple stop responding. At a certain point, it has also displayed a "Too many shift_map() - functions" message......

It seems as if there is an endless loop or an endless recursion in your code. Perhaps a missing wait()?

Re: 2d tile-based game - map problem [Re: Saturnus] #283824
08/10/09 09:37
08/10/09 09:37
Joined: Jul 2008
Posts: 170
Germany, near Mainz
Nicotin Offline
Member
Nicotin  Offline
Member

Joined: Jul 2008
Posts: 170
Germany, near Mainz
I just think that the function just gegt called as long the character is over 800. So as long the character is this far away the function callls every frame. Do you set him in the middle again?
so like
Code:
if(character.x > 800)
{
 shift_map();
 character.x = 0; 
}

?



Re: 2d tile-based game - map problem [Re: Nicotin] #283837
08/10/09 11:23
08/10/09 11:23
Joined: Aug 2009
Posts: 26
Goiânia - Brazil
D
dmBlack Offline OP
Newbie
dmBlack  Offline OP
Newbie
D

Joined: Aug 2009
Posts: 26
Goiânia - Brazil
The problem might just be there Nicotin... I´ve noticed that the shift_map() function is place within the main() function, so it´s called always, no matter where is the character... and the "if ... > 800" condition is already inside the function.....

actually it´s more like this

shift_map()
{
while(1)
if (character_pan.pos_x > 800)
{
character_pan.pos_x = 0;
create_map(map_code);
wait(1);
}
}

Perhaps I could put this check inside the character movement function? Or any suggestions?

thanks so far!

Re: 2d tile-based game - map problem [Re: dmBlack] #283839
08/10/09 11:24
08/10/09 11:24
Joined: Jul 2009
Posts: 25
oyUn ceHeNnEMi
turkkanka Offline
Newbie
turkkanka  Offline
Newbie

Joined: Jul 2009
Posts: 25
oyUn ceHeNnEMi
function shitf_map()
{
while(1)
if (character_pan.pos_x > 800)
{
character_pan.pos_x = 0;
create_map(map_code);
wait(1);
}
}


Turkish Game Producer Team

oyUn ceHeNnEMi
Re: 2d tile-based game - map problem [Re: turkkanka] #283844
08/10/09 11:37
08/10/09 11:37
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
Your wait() is within the if-branch.
So there is an endless loop if the condition (character_pan.pos_x > 800) is not met.

Re: 2d tile-based game - map problem [Re: Saturnus] #285041
08/16/09 18:59
08/16/09 18:59
Joined: Aug 2009
Posts: 26
Goiânia - Brazil
D
dmBlack Offline OP
Newbie
dmBlack  Offline OP
Newbie
D

Joined: Aug 2009
Posts: 26
Goiânia - Brazil
Thanks guys,

I just figured it out.

I was wondering if you guys have a better suggestion on how to change maps relatively.

What I mean is when I am on map A I should shift to map B while going to the right, but if I am already on map B I should change to map C.

For now I am just filling my script with "if"s and "||"s, but I feel that it is not the cool way to do this...

Re: 2d tile-based game - map problem [Re: dmBlack] #285073
08/16/09 21:45
08/16/09 21:45
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Show us more of these "if's and ||'s" and we'll see what can be done.
There will be 'other' ways, but that may not ne better.
It depends on what you need...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1