On 4 sep, 13:46, Chris Laux <[email protected]> wrote:
>
> Well, I'm doing a hard coded scale of (1, 1.5, 1) and even that doesn't look
> right. It looks like the sprite is getting moved as well as scaled.
>
> The effect I'm trying to get is a "laser beam" style line. I have a small
> sprite that I'd like to stretch out to be the effect. Any ideas for other ways
> to implement that? I've read that the line drawing stuff isn't very fast, and
> for that matter it isn't really what I want.
>
> And no, I'm not doing pyweek. I have enough stress as-is without trying to
> code a game in a week. ;)
>
> --
> -chris
There are relativelly slow, but woth a try: do something like
class SingleLine(cocos.cocosnode.CocosNode):
def __init__(self, p1,p2, color = None):
super(SingleLine,self).__init__()
self.vertexes = [point_float(*p1),point_float(*p2)]
if color is None:
color = (255,255,255,255)
elif len(color)==3:
color = tuple(list(color).append(255))
self.color = color
def draw(self):
glPushMatrix()
self.transform()
glEnable (GL_LINE_SMOOTH)
glEnable (GL_BLEND)
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glHint (GL_LINE_SMOOTH_HINT, GL_NICEST)
glLineWidth (1.5)
glBegin(GL_LINES)
glColor4ub( *self.color )
for v in self.vertexes:
glVertex2f(*v)
glEnd()
glPopMatrix()
but draw 3 times the lines, with
low alpha, 8.0 width
medium alpha, 4.0 width
high alpha , 1.0 width
that dont look bad.
adjust widths and alpha at will
--
claxo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cocos-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---