Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

3D cude Image problem with sprites ? please help :)

3D cude Image problem with sprites ? please help :)

3D cude Image problem with sprites ? please help :)

hi this my first time playing around with lingo and am using some code out of a book to create a 3d cude with images wrap around it. the problem is that it only using the first 6 sprites for images. and my images are on sprites 27,28,29,30,31,32. does any one no how to change it to read from the vaules i have the images on?? please find code below !!

global gCorners, gCenter, gRectList, gRotate, gPlane

on startMovie
  -- initialize lists for a cube

on frameScript
  -- add to rotation based on mouse location
  gRotate = gRotate - (float(the mouseH-320)/30)*pi()/100
  -- calc plane tilt based on mouse location
  gPlane = - (float(the mouseV-240)/30)*pi()/20

on initBox
  -- list of corners with x, y and z coordinates
  gCorners = [[-60,-60,-60],[60,-60,-60],[60,60,-60],\
  -- the screen center
  gCenter = point(400,300)
  -- list of sides
  -- each side has four corners
  gRectList = [[1,2,3,4],[1,2,6,5],[3,4,8,7],\

on drawSides
  -- generate a list of screen points and depths based on the
  -- gCorners list and the transformation to 2d screen coordiantes
  list = []
  repeat with i = 1 to gCorners.count
    temp = plotPoint(gCorners[i])
    add list,temp
  end repeat
  -- create a quad list that takes four points to display a side of the cube
  repeat with i = 1 to gRectList.count
    -- get the four corners that make this side
    thisRect = gRectList[i]
    -- get the four screen points to draw
    q = [list[thisRect[1]][2],list[thisRect[2]][2],\
    -- get the closest (depth) screen point
    z = min(list[thisRect[1]][1],list[thisRect[2]][1],\
    -- draw the side
    sprite(i).quad = q
    sprite(i).locZ = z
  end repeat

on plotPoint objectInfo
  -- get x, y, and z from objectInfo list
  x = getAt(objectInfo,1)
  y = getAt(objectInfo,2)
  z = getAt(objectInfo,3)
  -- compute the radius
  radius = sqrt(x*x+y*y)
  -- compute the angle
  if x = 0.0 then angle = atan(the maxInteger)
  else angle = atan(float(y)/x)
  if y < 0 then angle = angle + pi()
  -- rotate
  set angle = angle+gRotate
  -- compute new x, y, and z
  realX = radius*cos(angle)
  realZ = radius*sin(angle)
  realY = Z
  -- compute then radius
  radius = sqrt(realY*realY+realZ*realZ)
  -- compute the angle
  if realZ = 0 then angle = atan(the maxInteger)
  else angle = (atan(realY/realZ))
  if realZ < 0 then angle = angle + pi()
  -- rotate
  angle = angle - gPlane
  -- compute then new x, y and z
  screenX = realX
  screenY = radius*sin(angle)
  screenZ = radius*cos(angle)
  -- return both z, and the x and y point
  return  [screenZ,point(screenX,screenY)+gCenter]

RE: 3D cude Image problem with sprites ? please help :)

If you change these lines:
sprite(i).quad = q
sprite(i).locZ = z
sprite(i +  26).quad = q
sprite(i +  26).locZ = z
then it'll use sprite 27 - 32 instead of sprite 1 - 6.

Kenneth Kawamoto

RE: 3D cude Image problem with sprites ? please help :)

cheers for the reply very helpful !

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close