Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36140
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jeltedeproft@hotmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'operator': 0.03; '(self):': 0.09; '0),': 0.09; '0.1': 0.09; 'resolved,': 0.09; 'skip:[ 40': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'def': 0.10; '0):': 0.16; '0.001': 0.16; '250:': 0.16; 'doesnt': 0.16; 'skip:[ 50': 0.16; 'vpython': 0.16; 'module': 0.19; 'math': 0.20; 'import': 0.21; 'skip:c 70': 0.22; 'skip:s 70': 0.22; 'subject:problem': 0.22; 'skip:_ 20': 0.22; 'cc:2**0': 0.23; 'errors': 0.23; 'originally': 0.23; 'seems': 0.23; 'random': 0.24; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'appear': 0.26; 'have,': 0.27; 'fixed': 0.28; 'lines': 0.28; 'post': 0.28; 'points': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; 'code': 0.31; 'skip:- 10': 0.32; 'could': 0.32; 'getting': 0.33; 'skip:s 30': 0.33; 'problem': 0.33; 'guys': 0.33; 'skip:b 20': 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'clear': 0.35; 'described': 0.35; 'false': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'really': 0.36; 'visual': 0.36; 'subject:with': 0.36; 'itself': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'mean': 0.38; 'skip:l 20': 0.38; 'things': 0.38; 'from:no real name:2**0': 0.60; 'skip:u 10': 0.60; 'first': 0.61; 'here': 0.65; 'stuck': 0.65; 'skip:c 50': 0.66; 'color': 0.69; '250': 0.71; 'conclude': 0.84; 'points,': 0.84; 'dutch': 0.91; 'response,': 0.93 |
| Newsgroups | comp.lang.python |
| Date | Fri, 4 Jan 2013 12:01:10 -0800 (PST) |
| In-Reply-To | <mailman.100.1357327851.2939.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=84.196.102.66; posting-account=XZkGywoAAAAKWm9w_OVBHB3AkNMb2L0U |
| References | <6f3c7fdf-7439-43b1-b3a2-da9da019b1ec@googlegroups.com> <CAPTjJmqGoeb6M3kC8CJ=Vz5c5EKFfJZwfP72j9qKDmoBhOzEtQ@mail.gmail.com> <CAPTjJmo-QEepJVruAZtyy5reoSd-z0kJDbzR3APpzuSKtX2AnQ@mail.gmail.com> <CAN1F8qUueORN3Titi44TxYATyMhqAE6qBUSO1yFE_bceSfoE=w@mail.gmail.com> <mailman.100.1357327851.2939.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 84.196.102.66 |
| MIME-Version | 1.0 |
| Subject | Re: problem with exam task for college |
| From | jeltedeproft@hotmail.com |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Message-ID | <mailman.101.1357330300.2939.python-list@python.org> (permalink) |
| Lines | 178 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1357330300 news.xs4all.nl 6868 [2001:888:2000:d::a6]:37533 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:36140 |
Show key headers only | View raw
woow jeezes, thanks for the amazingly fast and detailed response, you guys are amazing.
let's clear a few things up :
1) points is a module in vpython to make points, the points do in fact appear although its not really the effect i intended to have, the points are "lined up" in stead of randomly separated, if you know what i mean
2) sorry for the dutch names :)
3) i put the parenteces there and then i got a bunch of errors which i fixed
2 problems:
a) my program seems to be stuck in the update phase of brandstoftank(=fuel tank), it doesnt get to the update of the spaceship
b) the problem i originally described in my first post was not resolved, by means of elimination i could conclude that the problem situates itself in this lines :
if (s == "left"):
self.gas = rotate(self.gas,angle = math.pi/10, axis = (0,0,1))
c = list(self.frame.axis)
c[2] -= 0.1
c = tuple(c)
c = self.frame.axis
if (s == "right") :
self.gas = rotate(self.gas,angle = -(math.pi/10), axis = (0,0,1))
c = list(self.frame.axis)
c[2] += 0.1
c = tuple(c)
c = self.frame.axis
i will put the full revisited code here :
from visual import *
import time
import math
import random
from datetime import datetime
import operator
class lunar_lander(object):
def __init__(self):
scene.title = 'mini star wars'
scene.width = 375
scene.height = 550
scene.center = (0,0)
self.pos = (0,0)
self.axis = 0
self.brandstofmeter_view = brandstofmeter_view()
self.ruimteschip = ruimteschip()
self.view = game_view(self)
def play(self):
t=0
dt=0.01
while t<999999999:
time.sleep(0.01)
self.brandstofmeter_view.update()
self.ruimteschip.update(dt)
t = t + dt
class game_view(object):
def __init__(self,owner):
autoscale=True
box(pos=( 0, -375, 0), length=500, height=5, width=0, color = color.white)
box(pos=(0,375, 0), length=500, height=5, width=0, color = color.white)
box(pos=(-250,0, 0), length=5, height=750, width=0, color = color.white)
box(pos=(250,0, 0), length=5, height=750, width=0, color = color.white)
maan = curve(pos=[(-250,-353),(-240,-341),(-210,-354),(-199.5,-374)],color=color.red)
maana = curve(pos=[(-199.5,-374),(-166,-374)],color=color.green)
maanb = curve(pos=[(-166,-374),(-140,-357),(-80,-319),(-40,-361),(0,-321),(40,-329),(80,-347)],color=color.red)
maanc = curve(pos=[(80,-347),(140,-347)],color=color.green)
maand = curve(pos=[(140,-347),(162,-337),(189.5,-365),(210,-355),(240,-372),(250,-338)],color=color.red)
for i in random.sample(range (-250,250),20):
for j in random.sample(range (-375,375),20):
sterren = points(pos = [i,j,0],size = 2, color=color.white)
class brandstofmeter_view(object):
def __init__(self):
axis = 0
self.pos = (220,345)
self.meter = box(pos = self.pos, lenght = 25, height = 45,color = color.green)
def update (self):
s = scene.kb.getkey()
if (s == "up"):
self.meter.height = self.meter.height - 1
class ruimteschip(object):
def __init__(self):
self.pos = vector(0,330)
self.acceleration = vector(0,-88,0)
self.axis = (1,0,0)
self.hoek = (90*math.pi)/180
self.graden = math.degrees(self.hoek)
self.gas = vector(10 * cos(self.hoek),10 * sin (self.hoek))
self.velocity = vector(0,0,0)
self.angle = (1,0,0)
self.view = ruimteschip_view(self)
self.vlam = self.view.vlam
self.frame = self.view.frame
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"):
self.velocity = self.velocity + self.gas
self.vlam.visible = True
b = b + 2
if (s == "left"):
self.gas = rotate(self.gas,angle = math.pi/10, axis = (0,0,1))
c = list(self.frame.axis)
c[2] -= 0.1
c = tuple(c)
c = self.frame.axis
if (s == "right") :
self.gas = rotate(self.gas,angle = -(math.pi/10), axis = (0,0,1))
c = list(self.frame.axis)
c[2] += 0.1
c = tuple(c)
c = self.frame.axis
if (a == 0):
self.vlam.visible = False
if self.pos.x > 250:
self.pos.x = -250
if self.pos.x < -250:
self.pos.x = 250
self.view.update(self)
class ruimteschip_view(object):
def __init__(self,owner):
self.owner = owner
self.frame = frame(pos = owner.pos,axis = owner.axis)
self.motor = curve(frame = self.frame,pos=[(0,24.0),(22.0,24.0),(22.0,39.0),(-22.0,39.0),(-22,24),(0,24)])
self.capsule = curve(frame = self.frame,color = color.blue ,pos=[(0,39),(-3,39),(-9,44),(-12,46),(-18,48),(-22,50),(-18,52),(-12,54),(-9,56),(-3,61),(0,61),(3,59),(9,56),(12,54),(18,52),(22,50),(18,48),(12,46),(9,44),(3,39),(0,39)])
self.poota = curve(frame = self.frame,pos = [(-18,24),(-20,24),(-20,0),(-18,0),(-18,24)])
self.pootb = curve(frame = self.frame,pos = [(18,24),(20,24),(20,0),(18,0),(18,24)])
self.vlam = curve(frame = self.frame,color = color.orange , visible=false,pos = [(0,24.0),(-9.0,14.0),(0,-5.0),(9,14.0),(0,24.0)])
def update(self,owner):
self.frame.axis = owner.axis
self.frame.pos = owner.pos
thanks again, are you guys getting paid for this or is this voluntarily? either way i really appreciate it
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