View Full Version : Help - Don't want object moving yet!
11-05-08, 12:06 PM
Hi, I need a bit of help with my AI moving object, it moves to exactly where it's supposed to, but I don't actually want it moving untill I use an object on it first.
Just wondering what I've not put in the code for it =\
set the status of it to 0 in the map. then set an IF statement in the update_room function, so that it only moves if the status is set to 1, then set the status of the item to 1 in the code once you've used the object on it.
22-05-08, 08:31 PM
Need a bit more help if possible, I wanna add some raindrops.
I've given them ids etc, but im not 100% sure what to put in the code, I did unpack a game, but it didn't seem to help =\
22-05-08, 10:36 PM
The idea is like this:
You have the update code that moves the object. This code is usually in the room's update callback, of the room where the object is. But it could be placed in a separate function, to easy call it from any room you have to.
You can use the object's O_STATUS property to store the movement status. Like 0 for not moving, and 1 for moving.
So, in the update code, you test if ObjGet(idx,O_STATUS)==0 and if so, you skip the movement (or exit your move function)
When you use the right item, you set the status of the object to 1, and the movement code will be executed.
That's usually for a single moving object.
If you want a rain with more moving drops, you can use a global variable, to restrict movement for all drops at once, to avoid setting O_STATUS for each of them.
Have a look at the winter tech demo, for a snow example (ai.gs).
If you need more help, let us know.
25-05-08, 07:54 PM
Thanks alex =)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.