Hello its me again. After the success of the last days I finally dare to wrap up the final details of a perfect “Kings Quest 7-ish†game…
For that I need something that’s actually pretty helpful for the player. When having backgrounds sometimes the player can not see at which point he can leave the room and go into another room (maybe when the background is a dark forest or when there is a secret pass way or whatever).
The thing is that I would like the mouse cursor to switch to an arrow symbol (which I will draw), while it is above the region on which the player has to walk in order to change into the next room.
It does sound pretty simple to just use “mouse.ChangeModeGraphic(eModeLookat, …);†But I don’t want the mousecursor to change when the player clicks at something. I want the cursor to change as soon as it hovers over the region, and I want it to change back into normal as soon as the cursor is off the region. But I have no idea about how to associate that since I have only “walks onto, walks off region…â€
Thanks a lot for any kind of help in advance!
One way, and I know there are other ways that may be better suited, anyhow, for a quicky until then:
Mouse moves over hotspot way when in Look mode.
1: Draw a hotspot area much bigger than you need where you want the mouse image to change (above region)
2: Draw a much smaller hotspot area inside the bigger hotspot area.
3: Use 'Mouse moves over hotspot' in the smaller hotspot events pane.
4: In the hotspot events pane where you want cursor to change put:
mouse.ChangeModeGraphic(eModeLookat, 1241); // change 1241 to your arrow sprite.
5: To change mouse back to default Lookat put this in the bigger hotspot events pane mouse over:
mouse.ChangeModeGraphic(eModeLookat, 233); // image of you default Lookat sprite
This example works only if you are using the Look Mode.
Don't forget to give the smaller hotspot description a name ie Exit... Leave the larger hotspot description blank.
You could of course use an object and control on / off instead.
Meanwhile wait for the bullets to fly (laugh)
http://www.adventuregamestudio.co.uk/forums/index.php?topic=41759.msg553607#msg553607
@ slasher:
The idea is really good, i havent thought of a Hotspot. I would totally do this since its really easy enought for me. BUT... i am using the "ultimate cursor" which is making it kind of difficult. Hence the cursorimage wont change. -_-
@ Khris:
Where do i put this code? Into the global script? (i still have a problem with imported functions just as i have trouble setting up the "death-scene" function in my game)
I think Khris referred :-[
global.asc, inside repeatedly_execute... try it and see
No doubt he will clear things up for you :P
"undefined token old_e = e;"
:-(
Just entering/copying the code seems not to work.
The code I linked you to uses hotspots, and no, you can't use it without getting a little bit into what it does.
// above repeatedly_execute
Region* old_r;
// inside repeatedly_execute
Region*r = Region.GetAtRoomXY(GetViewportX() + mouse.x, GetViewportY() + mouse.y);
if (r != old_r) { // mouse moved over region or left one
old_r = r;
int i = ??; // determine if region is exit or used for something else
if (r == 0 || i == 0) mouse.ChangeModeGraphic(mouse.Mode, DEFAULT_SLOT); // default walkto cursor graphic
else {
mouse.ChangeModeGraphic(mouse.Mode, FIRST_EXIT_ARROW_SLOT_MINUS_ONE + i); // change to arrow
}
}
The only thing left to do is find some way of setting i to the exits direction / to 0 if the region isn't also an exit.
You could add a function that uses lots of ifs:
int GetRegionExit(int id) {
if (player.Room == 2) {
if (id == 1) return 1; // north
if (id == 2) return 4; // west
}
...
}
Then use int i = GetRegionExit(r.ID);.
There are nicer ways, e.g. room_Load could set a global struct array:
function room_Load() {
SetRegionExit(1, eExitNorth);
SetRegionExit(2, eExitWest);
}
Cleaner and tidier but you also need a struct definition.