Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36365
| Date | 2013-01-07 18:40 +0100 |
|---|---|
| From | Vincent Vande Vyvre <vincent.vandevyvre@swing.be> |
| Subject | Re: problem with exam task for college |
| References | <6f3c7fdf-7439-43b1-b3a2-da9da019b1ec@googlegroups.com> <9d4db036-b840-4c2e-8cfb-edc2afb7bbaa@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.229.1357580886.2939.python-list@python.org> (permalink) |
Le 07/01/13 17:22, jeltedeproft@hotmail.com a écrit :
> ok after another round of reparations, my update works again and it updates the fuel meter, but i still can't get the view of the spaceship to rotate, for now only the direction the spaceship accelerates when pressing "up" changes after a rotation, but the spaceship itself keeps pointing up. This is the code for the rotating : p.s : the problem has to be in this code because the update of the view of the position of the spaceship does work.
>
>
> def update(self,dt):
> self.velocity = self.velocity + (self.acceleration * dt)
> self.pos = self.pos + self.velocity * dt
> a = 0
> b = 0
> if scene.kb.keys:
> a = a + 0.001
> s = scene.kb.getkey()
> if (s == "up"):
> if self.zicht.meter.height != 0:
> self.velocity = self.velocity + self.gas
> self.vlam.visible = True
> b = b + 2
> self.zicht.meter.height = self.zicht.meter.height - 0.1
> self.zicht.update
> if (s == "left"):
> self.gas = rotate(self.gas,angle = math.pi/10, axis = (0,0,1))
> (x,y,z) = self.frame.axis
> self.frame.axis = (x,y,z-0.1)
> if (s == "right") :
> self.gas = rotate(self.gas,angle = -(math.pi/10), axis = (0,0,1))
> (x,y,z) = self.frame.axis
> self.frame.axis = (x,y,z+0.1)
> if (a == 0):
> self.vlam.visible = False
Are you sure with this code:
(x,y,z) = self.frame.axis ?
frame.axis is a 'cvisual.vector' and this unpacking cause a program
crashes with a segfault.
For left-rigth moves of the LEM, this code seems works:
--------------------------------------
if scene.kb.keys:
key = scene.kb.getkey()
if key == "left":
# Set left deviation
self.frame.axis -= (0, 0, 0.05)
self.gas = vector(-sin(self.angle), cos(self.angle))
elif key == "right":
# Set right deviation
self.frame.axis += (0, 0, 0.05)
self.gas = vector(sin(self.angle), cos(self.angle))
elif key == "up":
self.deviate()
def deviate(self):
# Set modified velocity
self.frame.velocity += self.gas
self.frame.pos += self.frame.velocity
# Reset falling velocity
self.frame.velocity -= self.gas
--------------------------------------
with angle = PI / 2.0
--
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
problem with exam task for college jeltedeproft@hotmail.com - 2013-01-04 10:23 -0800
Re: problem with exam task for college Chris Angelico <rosuav@gmail.com> - 2013-01-05 05:59 +1100
Re: problem with exam task for college Chris Angelico <rosuav@gmail.com> - 2013-01-05 06:00 +1100
Re: problem with exam task for college MRAB <python@mrabarnett.plus.com> - 2013-01-04 19:17 +0000
Re: problem with exam task for college Joshua Landau <joshua.landau.ws@gmail.com> - 2013-01-04 19:18 +0000
Re: problem with exam task for college Chris Angelico <rosuav@gmail.com> - 2013-01-05 06:30 +1100
Re: problem with exam task for college jeltedeproft@hotmail.com - 2013-01-04 12:01 -0800
Re: problem with exam task for college Chris Angelico <rosuav@gmail.com> - 2013-01-05 07:36 +1100
Re: problem with exam task for college Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-05 16:09 -0500
Re: problem with exam task for college jeltedeproft@hotmail.com - 2013-01-04 12:01 -0800
Re: problem with exam task for college Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-04 17:11 -0500
Re: problem with exam task for college jeltedeproft@hotmail.com - 2013-01-05 04:24 -0800
Re: problem with exam task for college Chris Angelico <rosuav@gmail.com> - 2013-01-05 23:39 +1100
Re: problem with exam task for college jeltedeproft@hotmail.com - 2013-01-05 05:14 -0800
Re: problem with exam task for college Chris Angelico <rosuav@gmail.com> - 2013-01-06 00:32 +1100
Re: problem with exam task for college jeltedeproft@hotmail.com - 2013-01-07 08:22 -0800
Re: problem with exam task for college Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2013-01-07 18:40 +0100
Re: problem with exam task for college Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-07 15:36 -0500
Re: problem with exam task for college jeltedeproft_8@hotmail.com - 2013-01-13 04:29 -0800
Re: problem with exam task for college jeltedeproft@hotmail.com - 2013-01-13 04:48 -0800
Re: problem with exam task for college jeltedeproft@hotmail.com - 2013-01-13 05:57 -0800
Re: problem with exam task for college Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-13 17:28 +0000
Re: problem with exam task for college stefaang@gmail.com - 2013-01-14 04:57 -0800
Re: problem with exam task for college jeltedeproft@hotmail.com - 2013-01-14 08:01 -0800
Re: problem with exam task for college Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-14 13:54 -0500
csiph-web