News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

Lock the screen position

Started by Yona-TYT, October 07, 2018, 07:05:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT


I was thinking about a function to keep the screen in a section of the map, with this I can make the player stay in a marked region until he completes the assigned task.

Example: As seen in the image, the player must connect the track of the train to be able to advance to the next step, then at that moment he does not need to move the screen, then this is where blocking the screen makes a lot of sense, thus avoiding that the player gets lost beyond the area marked with (X).

  Is the same principle used when trying to go beyond the edges of the map... is it possible to implement that?.
Edit.
It would also be great to show a dark transparent layer (like the station cover) to visually indicate that the rest of the map is inaccessible temporarily and restrict the use of any tool beyond the limits, you should return a message if you use a tool .
It would be great to have this in the tutorial scenario, it would make things easier for me.
Regards !!.

ACarlotti

If this is implemented, then it should be in the form of a bounding box (or polygon of some sort) that the player can scroll to see the entirety of, but not scroll any further. Any system of bounding the centre of the view will probably fail when the window size is smaller than expected.

Yona-TYT


@ACarlotti
Do you mean to keep the course in the delimited or fenced region?
In any case, a minimum value can be set for the coordinate delimitations.

ACarlotti

Quote from: Yona-TYT on October 07, 2018, 11:48:07 PMDo you mean to keep the course in the delimited or fenced region?
I don't know what you mean here.

Yona-TYT

Quote from: ACarlotti on October 07, 2018, 11:07:38 PMIf this is implemented, then it should be in the form of a bounding box (or polygon of some sort) that the player can scroll to see the entirety of, but not scroll any further. Any system of bounding the centre of the view will probably fail when the window size is smaller than expected.

Sorry, I was the one who did not understand your message in the first place.

Quote from: ACarlotti on October 08, 2018, 12:03:07 AMI don't know what you mean here.
I was referring to the course that marks the tiles, that can not leave the delimited region.

An_dz

What ACarlotti is saying is that if the API is to set only a center coordinate it will fail if you build the scenario in a 1920x1080 fullscreen but the player is playing in a 800x600 window. You'll see much more area than the user.

So to prevent this happening one would set the area the user can see, with two sets of coordinates to set a rectangle.

Anyway, I don't think there should have an API to prevent the user from going around the map, instead there should have an API that draws a rectagle on the screen to let the user know that the objective will only validate inside that area.

Yona-TYT

I would like the rest of the map to be darkened with a dark transparent cover, as seen in the transparent station coverts.  ;)

Yona-TYT

I was trying to create a function that would shadow the map around a rectangle, but this is very difficult for me.

I know this creates the transparent cover I'm looking for, but I do not know how to make this cover the map completely:

simplan.cc (line 577)==============================================================
for(int halt_count = 0; halt_count < halt_list_count; halt_count++) {
    const FLAGGED_PIXVAL transparent = PLAYER_FLAG | OUTLINE_FLAG | color_idx_to_rgb(halt_list[halt_count]->get_owner()->get_player_color1() + 4);
    display_img_blend( img, xpos, ypos, transparent | TRANSPARENT25_FLAG, 0, 0);
}

An_dz

Shadowing the rest of the map would be too expensive, I think it makes more sense to just draw a thick border.

Yona-TYT


An_dz

Hard to tell now without looking the code, but you probably can use the graphics for the cursor border. Take a look in one of the pakset sources and you'll find what graphic I'm telling, it's a bunch of lines in multiple directions.