andfol

Members
  • Content count

    23
  • Joined

  • Last visited

Community Reputation

103 Neutral

About andfol

  • Rank
    Member
  1. I am trying to make a crossword in flash. I have just started, I have created a rollover that will act as a highlighter for the clues up and down. The problem is I create a box for text input and at the moment there is no text going into the box when I test the movie. I will provide the action script code I am am using for the rollover I would be grateful for any pointers on this. I think I am doing something wrong in flash rather than it being an action script error but heres the code anyway.   rollOv1._visible = false; rollOverButton.onRollOver = function(){     rollOv1._visible = true; } rollOverButton.onRollOut = function(){     rollOv1._visible = false; }                                     the rollOverButton is the text box and rollOv1 is the highlighted area.   
  2. Lighting on OpenGL polygon

    Hi, I am trying to implement some lighting on an eight sided polygon drawn with OpenGL. I have declared the type of light and how the surfaces react and position in my constructor: ambientLight[4] = 0.3f, 0.5f, 0.8f, 1.0f; diffuseLight[4] = 0.25f, 0.25f, 0.25f, 1.0f; spotLightPosition[4] = -25.0f, 0.0f, -230.0f, 1.0f; matAmbient[4] = 1.0f, 1.0f, 1.0f, 1.0f; matDiff[4] = 1.0f, 1.0f, 1.0f, 1.0f; Next I have an initialise function for the above: void CNutObsticle::initialize() { glClearColor(1.0f, 0.0f, 0.0f, 0.0f); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glFrontFace(GL_CCW); glEnable(GL_LIGHTING); glMaterialfv(GL_FRONT, GL_AMBIENT, matAmbient); glMaterialfv(GL_FRONT, GL_DIFFUSE, matDiff); glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight); glLightfv(GL_LIGHT0, GL_DIFFUSE, ambientLight); glLightfv(GL_LIGHT0, GL_POSITION, spotLightPosition); glEnable(GL_LIGHT0); glDisable(GL_LIGHTING); } If anyone has any ideas I would be grateful the code does compile but there is no lighting effect. Thanks.
  3. Scrolling static objects

    Hi, I have implemented scrolling on two players in the game I am creating using gluLookAt in main: {float x = (g_Player1.getPosX()+g_Player2.getPosX()/2); float y = (g_Player1.getPosY()+g_Player2.getPosY()/2); float z = (g_Player1.getPosZ()+g_Player2.getPosZ()/2); gluLookAt( x, y+50,z+100,x, y, z,0.0f,1.0f,0.0f);} I also have other objects in my game drawn with OpenGL that are static. I would like to get these objects to scroll through the game also. I would be grateful for any help. Thanks.
  4. Player animation going funny.

    This bug is now fixed.
  5. 3D Scrolling

    Hi Manabreak, Sorry its been so long what you suggested above worked it moves the player in and out keeping perspective but I was wondering is it possible to move the static objects in the scene so they appear to be moving past the moving players. I hope you are still following this I know its been a long time anyway I would be grateful for your feedback. Thanks andfol.
  6. 3D Scrolling

    Hi Manabreak, Hope you pick up this post, I tried using the GluLookAt() function like you suggested above: gluLookAt(g_Player1.getPosX()+g_Player2.getPosX(),g_Player1.getPosY()+g_Player2.getPosY(),g_Player1.getPosZ()+g_Player2.getPosZ(),0.0f,0.0f,0.0f,0.0f,1.0f,0.0f); I know this code is a bit messy, I have used my player objects to call the getPos variables. When I compile it it seems to work player2 moves across the screen as if scrolling although I have no movement on it, but player1 that does move according to keypresses just rotates around the screen and a primitive triangle I have drawn moves with it. Do you have a fix would be grateful.
  7. Hi, I have a player drawn in OpenGL with animation on it to make the legs and arms move. I have two arrays in the body of my constructor to keep track of movement: float armAngle[2] = {0.0f, 0.0f}; float legAngle[2] = {0.0f, 0.0f}; I draw a cube in OpenGL and call this function to draw the player arms, legs etc also using color, translate and scale. The drawPlayer function then draws and animates the player: void CPlayer::drawPlayer() { static bool leg1 = true; // robot's leg states static bool leg2 = false; // true = forward, false = back static bool arm1 = true; static bool arm2 = false; glPushMatrix(); glTranslatef(m_xPos, m_yPos, m_zPos);// draw robot at desired coordinates // draw components drawHead(1.0f, 2.0f, 0.0f); drawTorso(1.5f, 0.0f, 0.0f); glPushMatrix(); // if leg is moving forward, increase angle, else decrease angle if (arm1) armAngle[0] = armAngle[0] + 0.1f; else armAngle[0] = armAngle[0] - 0.1f; // once leg has reached its maximum angle in a direction, // reverse it if (armAngle[0] >= 15.0f) arm1 = false; if (armAngle[0] <= -15.0f) arm1 = true; // move the leg away from the torso and rotate it to give "walking" effect glTranslatef(0.0f, -0.5f, 0.0f); glRotatef(armAngle[0], 1.0f, 0.0f, 0.0f); drawArm(3.5f, 0.0f, -0.5f); glPopMatrix(); glPushMatrix(); // if leg is moving forward, increase angle, else decrease angle if (arm2) armAngle[1] = armAngle[1] + 0.1f; else armAngle[1] = armAngle[1] - 0.1f; // once leg has reached its maximum angle in a direction, // reverse it if (armAngle[1] >= 15.0f) arm2 = false; if (armAngle[1] <= -15.0f) arm2 = true; // move the leg away from the torso and rotate it to give "walking" effect glTranslatef(0.0f, -0.5f, 0.0f); glRotatef(armAngle[1], 1.0f, 0.0f, 0.0f); drawArm(-2.5f, 0.0f, -0.5f); glPopMatrix(); //DrawArm(-1.5f, 0.0f, -0.5f); // we want to rotate the legs relative to the robot's position in the world // this is leg 1, the robot's right leg glPushMatrix(); // if leg is moving forward, increase angle, else decrease angle if (leg1) legAngle[0] = legAngle[0] + 0.1f; else legAngle[0] = legAngle[0] - 0.1f; // once leg has reached its maximum angle in a direction, // reverse it if (legAngle[0] >= 15.0f) leg1 = false; if (legAngle[0] <= -15.0f) leg1 = true; // move the leg away from the torso and rotate it to give "walking" effect glTranslatef(0.0f, -0.5f, 0.0f); glRotatef(legAngle[0], 1.0f, 0.0f, 0.0f); // draw the leg drawLeg(-0.5f, -5.0f, -0.5f); glPopMatrix(); // do the same as above with leg 2, the robot's left leg glPushMatrix(); if (leg2) legAngle[1] = legAngle[1] + 0.1f; else legAngle[1] = legAngle[1] - 0.1f; if (legAngle[1] >= 15.0f) leg2 = false; if (legAngle[1] <= -15.0f) leg2 = true; glTranslatef(0.0f, -0.5f, 0.0f); glRotatef(legAngle[1], 1.0f, 0.0f, 0.0f); drawLeg(1.5f, -5.0f, -0.5f); glPopMatrix(); glPopMatrix(); } This player also has movement on it using GetKeyState called in main. if(GetKeyState(VK_UP) & 0x80) { g_Player1.move(0.0, 0.05, 0.0); } The problem is that after moving the player around the screen after a while the arms and legs on the player keep animating round in a full circle rather than the short steps they are supposed to take. I would be grateful for some help with this.
  8. 3D Scrolling

    I am not quite sure what you mean Manabreak don't have a camera class as such and I not too familiar with GluLookAt() method.
  9. Hi, I am trying to implement some collision detection on two OpenGL objects a player and a triangle. I have a collision detection method in a class that draws a triangle: bool CTriangleCollision::testCollision (float x, float y, float z, float r) { float d = sqrt ((x-m_xCPos)*(x-m_xCPos) + (y-m_yCPos)*(y-m_yCPos)); if(d < r) { return true; } else { return false; } } The parameter x has the x position of the player passed in and the same with the y parameter. I then call this in main in my loop: if(g_TriangleCollision.testCollision(g_Player1.getPosX(), g_Player1.getPosY(), 0 ,250)) { g_TriangleCollision.delete(); } else{ } I have used the delete function it has flagged an error and I am not sure about the condition for my collision detection function feedback on those would be good
  10. 3D Scrolling

    Can anybody point me in the direction for beginners tutorials on 3D scrolling. I have a window created for OpenGL also have a player that moves no collision detection yet. I would be grateful for any feedback.
  11. Drawing sphere

    Hi, I am trying to draw a sphere in OpenGL using auxSolidSphere(.....); in a function: void CSphereCollision::drawSphere() { glColor3f(0.0f, 0.5f, 0.5f); glTranslatef(m_xPos, m_yPos, m_zPos); auxSolidSphere(10.50); } with a constructor: CSphereCollision::CSphereCollision(float val1, float val2, float val3): m_xPos(val1), m_yPos(val2), m_zPos(val3) { angle = 0.0f; } and a destructor that does nothing I call it in main with an object with the values for position m_xPos, m_yPos, m_zPos passed into translate in the drawSphere function. My problem is that I get an fatal error LNK1120: 1 unresolved externals error message when I compile.
  12. Player movement.

    It worked but after a while my animated legs and arms do strange things. Any ideas?
  13. Player movement.

    Thanks Ghosrath it worked!!
  14. Player movement.

    Sorry just to add when I run the application pressing any key makes my player disappear.
  15. Player movement.

    Hi Pulpfist, Fixed the identifier problem, like an idiot didn't declare in main.h, I am still trying to write the PlayerKeys function if you have any suggestions would be grateful. Its the same as above just added more keys. Thanks.