Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

justin123

Members
  • Posts

    122
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by justin123

  1. The position of the sensors are rotated based on sonic's angle, so that seems to eliminate the need switching mode, unless I missed something.
  2. The images wasn't showing in my first post but its fixed now. What seems to be happening is somewhere around angles like 45 or 315, sonic begins to move in the opposite direction. So eventually he gets stuck in the middle. I can't figure out what could be causing this. My math functions output the same values as Game Maker's and collision is pretty much the same (but slower). I even went as far as testing the Revival Engine in debug mode and my own engine side-by-side in a identical map. the speed variables seemed to react the same and angles looked the same up to the point where you get stuck. This driving me crazy!!!
  3. I having trouble with curved slopes. The player makes it half way but gets stuck in the middle of the curve. The physics my engine uses is a direct port of the revival engine. I only had to change the way loops work since the Angel Script language doesn't have a "repeat()" loop or "do{}until()" loop. but here's the physics function: sorry about the formating void Physics() { // X Movement x += cos(degtorad(angle)) * x_speed; y += sin(degtorad(angle)) * x_speed; while (CollisionLeft( x, y, angle, maskMid) && x_speed < 0) { x += cos(degtorad(angle)); y -= cos(degtorad(angle)); } while (CollisionRight( x, y, angle, maskMid) && x_speed > 0) { x -= cos(degtorad(angle)); y += cos(degtorad(angle)); } //Y Movement if (!ground) { y += y_speed; // move the player outside in case he has got stuck into the floor or the ceiling while (y_speed < 0 && CollisionTop( x, y, 0, maskMid ) == true ) { x -= sin(degtorad(angle)); y += cos(degtorad(angle)); //y += 1; } while (y_speed > 0 && CollisionBottom( x, y, 0, maskMid ) == true ) { x += sin(degtorad(angle)); y -= cos(degtorad(angle)); //y -= 1; } if (y_speed >= 0 && CollisionBottom( x, y, 0, maskBig ) == true) { if ( CollisionLeftLimiter(0.0f) && CollisionRightLimiter(0.0f) ) { ChangeAngle(GetAngle( x, y, 0 ), gravity_angle); } else { ChangeAngle(0, gravity_angle); } x_speed -= sin(degtorad(angle)) * y_speed; y_speed = 0; ground = true; } } while (CollisionLeft( x, y, angle, maskMid) && x_speed < 0) { x += cos(degtorad(angle)); y -= cos(degtorad(angle)); } while (CollisionRight( x, y, angle, maskMid) && x_speed > 0) { x -= cos(degtorad(angle)); y += cos(degtorad(angle)); } //Slopes if (ground == true) { if (CollisionMain( x, y ) ) { while(CollisionMain( x, y)) { x -= sin(degtorad(angle)); y -= cos(degtorad(angle)); } } if (CollisionSlope( x, y, angle, maskMid ) && !CollisionMain( x, y ) ) { while(!CollisionMain( x, y )) { x += sin(degtorad(angle)); y += cos(degtorad(angle)); } } } //Other //fall if there isn't enough speed if (angle > 80 && angle < 280 && ground == true && abs(x_speed) < 3) { y_speed = -sin(degtorad(angle))*x_speed; x_speed = cos(degtorad(angle))*x_speed; ground = false; } // fall off the ground if the edges aren't colliding if (ground == true && angle != 0 && (CollisionLeftLimiter(angle ) == false || CollisionRightLimiter(angle ) == false )) { y_speed = -sin(degtorad(angle))*x_speed; x_speed = cos(degtorad(angle))*x_speed; ground = false; } // get new angle if (ground == true && CollisionLeftLimiter(angle) && CollisionRightLimiter(angle)) { // Store the new angle angle_holder = GetAngle( x, y, angle ); // Check if difference is less than 45. If it is, linear interpolate the angle, so it results on smoother rotation. // Otherwise, set the new angle normally. Remember that linear interpolation formula is the next: // // final = a*t + b*(1-t); where t is the interpolation value, wich goes from 0 to 1 // // There's also a shorter and faster method, wich is the one we're going to use: // // final = a + (b-a)*t; if (abs(angle-angle_holder)<45) ChangeAngle(angle + (angle_holder-angle)*0.5, gravity_angle); else ChangeAngle(angle_holder, gravity_angle); } else { ChangeAngle(0, gravity_angle); } } For some reason I can get the player to get unstuck and traverse the curve if I first get stuck for a while and press the opposite arrow key (releasing the other). Then thinking that it will go in the opposite direction, instead it makes it through the other half of the curve. Does anyone have any ideas?
  4. I guess the c/c++ programmers are excluded. Lol
  5. Plays pretty good. No complaints but the file size. I would go with .7z instead of .zip to get a smaller file size.
  6. I'm trying to recreate Game Maker's collision line function in my C++ engine, but I don't think that its accurate at all. My engine uses collision based off of masks (using PMASK) and a spacial partitioning system to filter out most of the unneeded collision tests. Heres the code: bool collision_line( float x1, float y1, float x2, float y2, int ObjectId) { Vector2 vec1(x1, y1); Vector2 vec2(x2, y2); std::vector<GridCell*> cells; GridCell *last = NULL; PMASK mask; float d = 0; int length = 1; length = round((GetDistance( vec1.x, vec1.y, vec2.x, vec2.y))); if (length < 1) { return false; } int size = make_even( length)*2; init_pmask( &mask, size, size); fill_pmask( &mask, 0); d = wrap_angle(point_direction( x1, y1, x2, y2)); for ( int x = 0; x < length; x++) { int px = (size/2) + floor(cos(degtorad(d) * x)); int py = (size/2) + floor(sin(degtorad(d) * x)); set_pmask_pixel( &mask, px, py, 1); } for (int l = 0; l < length; l += CELL_SIZE) { int px = floor(cos(degtorad(d)) * l); int py = floor(sin(degtorad(d)) * l); GridCell *cell = objectManager->GetGrid()->CellAt( px, py); if (cell != NULL && cell != last) { cells.push_back( cell); } last = cell; } for (int n = 0; n < cells.size(); ++n) { std::vector<Object* const> list; list = cells[n]->GetObjects(); for ( int i = 0; i < list.size(); ++i) { if (list[i]->GetType() != ObjectId) { continue; } const Sprite *spr = renderEngine->_get_sprite(list[i]->mask_index); if (spr == NULL) { deinit_pmask( &mask); return false; } Rect r = list[i]->rect; if (check_pmask_collision( &mask, &spr->mask->mask, floor(vec1.x) - (size/2), floor(vec1.y) - (size/2), floor(list[i]->x - spr->CenterX), floor(list[i]->y - spr->CenterY)) == 1) { deinit_pmask( &mask); return true; } } } deinit_pmask( &mask); return false; } [/CODE] This function draws a line on a new mask and compares it to all of the other objects' masks in the cells that the line intersects. It seems that it never returns true when it should. What do you guys think I am doing wrong?
  7. It ran perfect for me. This is one of the most interesting things I've seen on here for a while. We don't have many C programmers here you know. This project has potential to become something great (maybe even good enough to get Cease-And-Desist award if SEGA gets jealous).
  8. *Tile collision is almost impossible in GM because it is not checked on anything else other than objects, unless you get extremely creative. (Tried it myself, can get too slow.) *There is extension that you can use for online multiplayer called "39.dll" that has tons of functions. You can find tutorials on th GMC on how to use it.
  9. Well yeah, I can say it could be strictly for sonic games, but when it comes to designing 2D engines, I don't usually confined it to one kind of game (well at least not my c++ engines).
  10. Reading about ENIGMA was kinda like a kick in the balls. I think I'll still go through with this to make my games. Maybe I'll have something I could sell.
  11. I'm starting a project thats going to be a program Identical to Game Maker, but the Only difference will be that instead of interpreting code it will all be compiled (probably with GCC or Visual Studio) and you will have the option to export C++ source code. I write this to ask what features do you wish Game Maker could have had? The things that came to my mind: Full 3D Support Compiled Language! Completely free Feel free to shoot me down, but I working on this project as I type this.
  12. if its a object, it always has the same value game maker assigns it at runtime and cannot be changed. So, you will have to make a global variable at the beginning of each level holding the character id.
  13. is objPlayer a object or just a global variable? If it is a object, then thats probably why it only shows sonic.
  14. To really simple things down try this: switch ( objPlayer) { case 1: curFrame=4; break; case 2: curFrame=5; break; case 3: curFrame=6; break; } [/CODE] I noticed you have a lot of if statements. Try to drop some of them, like: [CODE] if (active) { if (floor(curFrame) >= 4) {timeslooped+=1; curFrame=0;} if (timeslooped >= 14) { switch ( objPlayer) { case 1: curFrame=4; break; case 2: curFrame=5; break; case 3: curFrame=6; break; } } else { curFrame += 0.5; } } [/CODE] This is the way I would go about it. I try to keep my code nice and simple. EDIT: You might want to add a variable to tell whether it is finished or not so you can add the sound effect in and set the alarm, but I'll let you figure out where to put it.
  15. Wow this looks great! I can't wait to test it out!
  16. I'm pretty sure I have the latest directx version. I'm write programs in c++ using directx, so could it be that I'm using the debug libs instead of the retail libs?
  17. The new build doesn't work on my home computer. Maybe because its a crappy Emachine lol.
  18. I recommend that you don't get into SFML hell. Try getting your hands on the latest OpenGl libraries ( although DirectX SDK is a whole lot easier to get a hold of) and start from there. There are a bunch of tutorials to get you started, GameDev.net has googobs of tutorials and articles and a forum full of professionals.
  19. might be some on GOOGLE. You can do it, just type google.com in the address bar. There you go, you did all by yourself. I'm so proud of you:smidge: .
  20. You should give more info about your project.
  21. Aw crap, I won't have my c++ engine ready in time!
  22. I would start-off in Game Maker, then eventually move up to C++ because GML pretty much teaches you C++ logic.
×
×
  • Create New...