I wanna make a decent game, but logicbricks just end up everywhere! So, I’ve taken Social’s advice and started to learn python (actually I did that a while ago but now I’m using it for more than just turning on and off the mouse)
What I’m trying to do is, using an empty when the player has his back to the wall, get the camera to zoom right in and the player fading away , so the camera doesn’t go straight through the wall. I’m trying to use some python to setDLoc, but it doesn’t work (It’s a bit of a guess )
if Wall.isPositive():
Motion.setDLoc(“0.00”,“0.10”,“0.00”,“l”)
and I was also wondering if I have to state ‘if Wall.isPositive():’ again if I want it to also set another actuator to track to the empty. Or maybe there is some way to do it with ipo curves, any help or advice would be appreciated
Hey, I don’t have an answer for your Python question (too tired to think), but I believe ST150 wrote a tutorial on keeping your camera from going through the wall. It’s here:
My python tutorial is in the demos/tuts sticky. Find it, go through it and learn it.
One of your problems is that “.setDLoc()” doesn’t take in strings, and that’s what you are trying to put in.
In python, everything you put in quotes “__” is a string, so numbers in “quotes”, (like “0.10”), are actually strings.
Also, putting in “l” in the last holder? That’s not right. You can only use numbers, so its either 1 for local translation, or 0 for global.
Lastly, im not sure if your indents are right, because you didn’t use the code tags to post your code. Well, anyway, just make sure it looks like this:
if Wall.isPositive():
Motion.setDLoc(0, 0.1, 0, 1)
You should learn python if you plan to get into serious development, but I think at this stage you are much better off going with that link blendenzo posted for camera actions, than actually trying to write your own python handler for it, when you don’t really know that much python.
Ok, thanks guys. I should have waited till the morning before posting this one. That camera script was just what I was looking for, I should of had a more decent search. Yes I am only a begginer with python (didn’t get off to a good start) I read you tutorial Social and it was very helpful, thankyou