Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About ianmclean0001

  • Rank
  1. ianmclean0001

    SDL save Surface as PNG/JPG

    Hi there just a quick question. I would like to be able to save a sdl surface as a png or a jpg. I am using sdl_image and have check the documentation there seem to be a load function but not a save function. I have used the SDL_SaveBMP function but I plan to have the image uploaded to a web server and read by php. unfortunately php can't read bmps but it can read jpg,png ect. I'm basically using the image to sort data as pixel colors. hope you can help thanks Ian
  2. ianmclean0001

    player move movement

    thank again jyk :) I can see why the player never reaches the destination. sorry I didn't did mean to be misleading I have never heard of a relative translation. sorry for asking a dumb question but why are ints a bad idea for storing position data? cheers ian
  3. ianmclean0001

    player move movement

    hi jyk thanks for the response sorry about the delay :) void CPlayer::Move(int X_Dir,int Y_Dir) { int NEW_X_POS = 0; int NEW_Y_POS = 0; if((PLAYER_X+X_Dir>0) && ((PLAYER_X+X_Dir)+PLAYER_SIZE <320)) { NEW_X_POS = PLAYER_X+X_Dir; }else{ NEW_X_POS = PLAYER_X; } if((PLAYER_Y+Y_Dir>0) && ((PLAYER_Y+Y_Dir)+PLAYER_SIZE <240)) { NEW_Y_POS = PLAYER_Y+Y_Dir; }else{ NEW_Y_POS = PLAYER_Y; } SetPos(NEW_X_POS,NEW_Y_POS); }
  4. ianmclean0001

    player move movement

    hi dustin the Player.Move function take the coordinates thanks Ian
  5. ianmclean0001

    player move movement

    Hi there I have a really quick question. I am using this easy script to move the player on a set path but the player never seem to reach the targetx or targety values to fire the pop_back to move to the next position. player.Move( ((targetx-player.GetX())/2) ,((targety-player.GetY())/2)); if( (targetx == player.GetX()) && (targety == player.GetY()) ) { player.pop_back(); } is there a different movement script I can use to move the player to the exact location. hope you can help Ian
  6. ianmclean0001

    simple path finding

    thanks for the help I have started to look at A* but hoping I wouldn't have to use it. I've never managed to get my head round it. :) thanks again Mac
  7. I have found out read is a reserved word so if you want to use a column call read you need to let the server know it a column by using the stupid ` http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html
  8. Cubist I did say that the server MAY be set to strict try if read is an int you don't need to use the ' "UPDATE submissions SET read = 1 where id = $id"
  9. it depends how Mysql is set up it may have strict SQL set that means columns,tables and statements become case sensitive.
  10. Hi Cubist try "UPDATE submissions SET read = '1' where id = ".$id
  11. ianmclean0001

    simple path finding

    Hi there I hope this make sense ;) I am having some trouble with a simple path finding script that I am trying to write. Basically I have a node list (I called them waypoints) each waypoint as a list of adjacent nodes. I have a find path function which takes the current node and the target node. The function looks at the current nodes adjacent node list and tries to find the closest node to the target. It then goes through to process until it finds the target node. I have got the feeling I haven't got the basics of pathfinding right. I have looked at A* pathfinding but the examples I have seen are grid based so I didn't under stand how to apply it to this problem. any help or advice would be really appreciated. Thanks Mac not sure if its worth showing you but here is the FindPath function please forgive my code I am new to C++. void PathState::FindPath(int CurrentWayPoint,int TargetWayPoint) { if(!path.empty()) path.clear(); int TragetX = waypoints[TargetWayPoint].WAYPOINT_X; int TragetY = waypoints[TargetWayPoint].WAYPOINT_Y; path.push_back(CurrentWayPoint); int ChildWayPoint; int LastChildWayPoint; int ChildDistance; int ShortestDistance; bool Add; int Counter = 1; while(CurrentWayPoint!=TargetWayPoint) { if(Counter>=waypoints.size()) break; Add = false; ShortestDistance = 1000; for(int i = 0; i < waypoints[CurrentWayPoint].ADJACENT_POINTS.size(); i++) { int AdjPoint = waypoints[CurrentWayPoint].ADJACENT_POINTS; if(AdjPoint==TargetWayPoint) { path.push_back(TargetWayPoint); break; } ChildDistance = CalculateDistance(TragetX,TragetY, waypoints[AdjPoint].WAYPOINT_X , waypoints[AdjPoint].WAYPOINT_Y ); if(ChildDistance<ShortestDistance) { ShortestDistance = ChildDistance; ChildWayPoint = AdjPoint; Add = true; } } if(Add) { path.push_back(ChildWayPoint); LastChildWayPoint = CurrentWayPoint; CurrentWayPoint = ChildWayPoint; } ++Counter; } }
  12. ianmclean0001

    simple path finding

    hi klee thanks for getting back to me I think monkey island must have a some sort of path finding if you click on an object guybrush would make is way over to it. I have taken a look at the A* algorithm but it doesn't seem appropriate. Ideally I am looking to use the same method as monkey island. thanks again Ian
  13. Hi there I am hope I am posting the the right place. I am curious to know how games like monkey island, full throttle and machinarium handle the character path finding. Is there some like of way point that are using to determine the best path the character can move to. Hope you can help thanks Ian :)
  14. ianmclean0001

    displaying second in the right format

    cheers szecs that worked perfectly thanks again guys Ian :)
  15. ianmclean0001

    displaying second in the right format

    thanks buckeye I didn't think of using an inline if but I'm getting an empty character constant don;t think c++ like the :'' part of the if statement secs < 10 ? '0':'' cheers ian
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!