Corby |
Hello, I'm sorry if this sounds really dumb but I need to know how to do one simple thing. I'm almost done my game but I need this one thing. I have a view (a car) and I want it to move from the left side of the screen to the right side. Can someone tell me everything I have to do? I spent a whole day trying to do this with no luck. This is what I've tried: define object animate.obj load.view set.view position draw start.cycling move.obj but it doesn't move! Do I have to use set.dir or something? I have basically no programming skills! Help! |
Sami_Tervo |
here's example that should work: animate.obj(o10); load.view(10); set.view(o10,10); position(o10,5,100); draw(o10); move.obj(o10,145,100,2,f255); if that won't work, check out example at: http://koti.mbnet.fi/sterv/car.zip |
Corby |
Wow! That was easy! Thanks! Here's another easy problem: I have two doors. How can I differentiate between the two so my character can walk to one individually and open it? |
Andrew_Baker |
I'm going to assume that you want to have the ego move to the door? This isn't really much of a move object problem, but here's an example with some movement code. Let's assume that one door is on the left side of the screen, and the other is on the right. If your character is on the left-hand side, we'll have him open the left door. If he is on the right-hand side, we'll have him open the right door. So: if (said("open","door")) { left door if (new_ego_x < 80) { program.control(); move.obj(ego,x,y,stepsize,doneflag); if (doneflag) { end.of.loop(oLEFTDOOR,anotherdoneflag); //Above should animate door opening player.control(); set(left_door_open); } } if (new_ego_x > 80) { program.control(); move.obj(ego,x,y,stepsize,doneflag); if (doneflag) { end.of.loopoRIGHTDOOR,anotherdoneflag); player.control(); set(right_door_open); } } } I left the variables open, since I have no idea where your doors are going to be, but that should give you something to chew on. |
Corby |
Thanks alot. That really helped! |