Official Fangame Help Topic

Wow, we got a lot done, :astonished:.

Here’s where I’m stuck at:

if (global.mcollected[0] == true) global.area_symbol[5,5] = 2; else global.area_symbol[5,5] = 1;

How could I define “1” as a dot symbol, and “2” as a circle symbol?

BTW these are the new symbols:

Better?

There, you don’t. Just maybe add some comments like // 1 is dot, 2 is circle

However, when you replace draw_symbol() in the map code, that’s when you’ll match those numbers to the right symbol.

If you keep the symbols in one sprite like that, you can use draw_sprite_part() on it and draw the right symbol. ((global.area_symbol[i,j]-1)*8 for the left var, or something like that)

If you separate it into separate sprites in the game, you can just use draw_sprite() but use if-else statements to draw the right one. (like: if (global.area_symbol[i,j] == 1) draw_sprite(spr_itemdot,…); else if (etc.))

Or if you keep them as one sprite but use different sub-images for each symbol, you could make only one call to draw_sprite() but use the value in global.area_symbol[i,j] to get the sub-image, similar to the draw_sprite_part() idea. The choice is yours, but it doesn’t really matter. >_>

And yeah, those new symbols are fine.

Okay, I added this:

if (global.area_symbol[i,j] == 1) draw_sprite(spr_itemdot,0,x,y); else draw_sprite(spr_itemcir,0,x,y);

How would I make X and Y be coordinates [5,5] on the map?

My brain hurts as if I were in school, :astonished:.

The if-else’s should be this:

if (global.area_symbol[i,j] == 1) draw_sprite(spr_itemdot,0,x,y); else if (global.area_symbol[i,j] == 2) draw_sprite(spr_itemcir,0,x,y);
Because this will go for every box, and if a box has symbol 0 nothing should be drawn.

As for the x’s and y’s, it should be the same as the box drawn before the symbol. (the i and j will store 5,5 eventually, so don’t worry about that particular box) So replace “x,y” with “view_xview[view_current]+276+(i+1-SamusMapx)*8, view_yview[view_current]+3+(j+1-SamusMapx)*8” in the draw_sprite()'s above. Yeah, it’s a lot of code, so once it’s up and running in the game we’ll try to speed it up.

The game won’t compile again: Here’s another code check:

DRAW EVENT OF HUD

/////MAP CODE/////

SamusMapx = floor(Samus.x/320)+global.room_x; 
SamusMapy = floor(Samus.y/240)+global.room_y; 

//Draw Black Box Code :O
//draw_set_color(c_black); 
//draw_rectangle(view_xview[view_current]+275,view_yview[view_current]+2,view_xview[view_current]+299,view_yview[view_current]+26,false);
//draw_set_color(c_white);
//End of Draw Black Box Code

draw_sprite(spr_mapdata,0,view_xview[view_current]+275,view_yview[view_current]+2);

for (i = samusMapx-1; i <= samusMapx+1; i += 1)
{
for (j = samusMapy-1; j <= samusMapy+1; j += 1)
{

 &nbsp;if (i > 0 && j > 0 && i < global.area_width && j < global.area_height)
 &nbsp;{
 &nbsp; &nbsp; &nbsp;if (global.area1_explored[i,j] == true)
 &nbsp; &nbsp; &nbsp;{
 &nbsp; &nbsp; &nbsp;draw_sprite_part(global.mapimage,0,1+i*8,1+j*8,8,8,view_xview[view_current]+276+(i+1-SamusMapx)*8,view_yview[view_current]+3+(j+1-SamusMapx)*8);
 &nbsp; &nbsp; &nbsp;if (global.area_symbol[i,j] == 1) draw_sprite(spr_itemdot,0,view_xview[view_current]+276+(i+1-SamusMapx)*8, view_yview[view_current]+3+(j+1-SamusMapx)*8);
 &nbsp; &nbsp; &nbsp;else if (global.area_symbol[i,j] == 2) draw_sprite(spr_itemcir,0,view_xview[view_current]+276+(i+1-SamusMapx)*8, view_yview[view_current]+3+(j+1-SamusMapx)*8); &nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp;}
 &nbsp;}
}
}[/code]


[code]ROOM CODE

global.room_x = 0;
global.room_y = 0;

global.area1_explored[i,j] = true

init_area_1();

//Item Collection Code
m_e.collection = "global.area1_missile1 = true";

[code]SCRIPT init_area_1
if (global.area != 1) // * = area #
{
global.mapimage = Map1; // * = map sprite
global.area_width = 6;
global.area_height = 6;

/*
You do have global variables for the items, right?
So that if you collect an item, leave the room, and come back…
…It’s not there? If so, here’s where you look at all those
to see if they’re collected or not, and set the correct symbol
on the map
*/

// So you’d clear out all junk from previous areas on the map
for (i = 0; i < 6; i += 1)
{
for (j = 0; j < 6; j += 1)
{
  global.area_symbol[i,j] = 0;
  global.area_symbol[5,5] = 2;
  global.area_symbol[0,0] = 2; //temporary, for testing
}
}

// Then here’s where you’d fill in the symbols over the default set above
if (global.mcollected[0] == true) global.area_symbol[5,5] = 1;
else global.area_symbol[5,5] = 2;

if (global.mcollected[1] == true) global.area_symbol[0,0] = 1;
else global.area_symbol[5,5] = 2;
}

[/code]

GM detects no syntax errors, but I’m very sure it’s the script that I need to fix. I’ll update it now.

EDIT: Added this:

[code]  

global.area_symbol[5,5] = 2;
global.area_symbol[0,0] = 2; //temporary, for testing[/code]

What’s the error message(s)?

Edit:
Oh, down here in init_area_1():

global.mcollected[1] should be the variable you set it to be in the room’s creation code for that missile expansion. checks

Yeah, should be global.area1_missile1, since that’s the one that particular missile uses.

It just “failed to compile the actions in the objects”.

And, here’s the new bit of code:

[code]if (global.area1_missile0[0] == true) global.area_symbol[5,5] = 1;
else global.area_symbol[5,5] = 2;

if (global.area1_missile1[1] == true) global.area_symbol[0,0] = 1;
else global.area_symbol[5,5] = 2;
}[/code]

I did the same for the test missile expansion, and the real one.

That’s the most bizarre error message I’ve ever heard. Does it give a line of code or a specific object?

Also:
global.area1_missile0[0]
global.area1_missile1[1]
A little redundant to have two 0’s and two 1’s. :stuck_out_tongue:

I found the problem, it was in my Samus object’s collision with a Missile Expansion.

Before:

[code]global.maxmissiles+=5;
global.missiles+=5;

global.mcollected[0] == true
execute_string(mcollection);[/code]

After:

[code]global.maxmissiles+=5;
global.missiles+=5;

//global.mcollected[0] == true
///execute_string(mcollection);
[/code]

Yeah, I forgot I never finished making the global variables for the missiles. :astonished:

Well, when the game runs, nothing related to the map appears. Is the Draw Event of my HUD the right place to put all the drawing code?

Yeah.

…

You can remove all of the “global.mcollected[0]” vars, since we’ve established that the actual name for it is area1_missile0[0] and so on. I think that’s the line that’s causing the problem, because there are two equal signs in a row there, which only work when you’re comparing two values, not assigning a value to a variable.

So etch out the line with “global.mcollected[0]”, since the line right after it (un-comment it, it should work) covers setting the variable to collected.

Edit: Oh oh oh!
After this code:

SamusMapx = floor(Samus.x/320)+global.room_x;
SamusMapy = floor(Samus.y/240)+global.room_y;

Add this:
global.area1_explored[SamusMapx,SamusMapy] = true;

The mini-map isn’t going to show anything if it thinks Samus hasn’t been in the square she’s standing in. :stuck_out_tongue:

Forgot about that.

Yeah, I added that in the room creation code a while back, but I used [i,j] instead of Samusmapx, Samusmapy.

I fixed the mcollected vars, and the Missile Tank object. I still have to finish the global “itemcollected” variable thing though.

So, I ran the game (no errors, thank god) and nothing appeared again. >_<

i and j shouldn’t be used unless they’re inside two “for” loops. They’ll be random leftover junk numbers elsewhere. Leave setting the areas Samus has explored to the map code, since it’s called each frame and will be more accurate (the room creation code is only called when the room starts–if Samus steps into a new square on the map, nothing will happen when that code is in the room creation code–might explain why nothing’s showing up). That and SamusMapx and SamusMapy aren’t even declared in the creation code, so they’ll probably just be 0s or errors.

Does the black box even appear? If not, there’s a problem. Otherwise there’s less of a problem.

…

It doesn’t appear. T__T

Looks back at the black box code
Ah, well, the first thing you could do is uncomment the black box. >_____>

If it still doesn’t show up, you could try something like draw_set_alpha(1) at the start, but it should show up.

I did uncomment it, yet it still wouldn’t show up. I’ll try adding the alpha code right now.

EDIT: Still won’t work. :astonished:

Okay then… Make sure that
A.) It’s in the draw event of the HUD object
B.) The HUD object is in the room >_>

I have a hunch it’s B.

Otherwise, I have no idea what’s up.

No, A and B are both fine.

http://www.megaupload.com/?d=1DYCBVZW

above is a link to a platform game i am making. when you play it you will notice that when the character goes off screen to the left, he appears on the other side. Why doesn’t he appear back to the left side when you try to go back?

If you add something that would cause an error in-game (try execute_string(“LOLSYNTAXERROR”); ) and it doesn’t happen, then it means the object’s draw event isn’t being executed, leading back to those two options I gave which you should definitely check over again.

Edit:
MetroidKid: It loops on the left because you probably have something like an “Outside Room” event warping it to the right side. But then once you warp to the right and step outside the boundaries, it still just teleports you to the right side…which therefore does nothing. Add some extra stuff like “if x is less than 0, teleport to the right side of the room, otherwise teleport to the left” in that event. You may have to work out the positions correctly to prevent the character from getting stuck teleporting back and forth from side to side.

that doesn’t make any sense… i proggramed it with the outside room equals wrap in both directions drag and drop icon. it worked in maniac maze, why not this game?