static void CaculNeedle() { if (buff_needle != null) { for (int i = 0; i < buff_needle.Length; i++) { if (buff_needle[i].active) { float x = role.location.x - buff_needle[i].location.x; if (x < 0) { x = -x; } if (x < buff_needle[i].distance) { x = role.location.y - buff_needle[i].location.y; if (x < 0) { x = -x; } if (x < buff_needle[i].distance) { if (PToP2A(ref buff_needle[i].points, ref motion)) { role.location = role.loc_back; role.motion.x = 0; role.motion.y = 0; save.die_count++; buff_t[0].text = "Die:" + save.die_count.ToString() + "\r\n" + "Archive:" + save.achi_count.ToString(); buff_t[0].screen_pos.X = screenX * 0.5f - 40; FileManage.SaveArichive(save); return; } } } } } } }
public static void UpdateRole() { role.time--; if (ks.IsKeyDown(Keys.J)) { if (role.jump > 0 & role.time < 0) { role.time = 15; if (!role.flooer) { role.jump--; } role.motion.y = dy; } } if (ks.IsKeyDown(Keys.K)) { if (role.jump > 0 & role.time < 0) { role.time = 15; if (!role.flooer) { role.jump--; } role.motion.y = dy * 0.8f; } } if (ks.IsKeyDown(Keys.F1)) { if (role.time < 0) { role.time = 15; role.loc_back = role.location; save.achi_count++; save.loaction = role.location; buff_t[0].text = "Die:" + save.die_count.ToString() + "\r\n" + "Archive:" + save.achi_count.ToString(); buff_t[0].screen_pos.X = screenX * 0.5f - 40; } } if (ks.IsKeyDown(Keys.R)) { if (role.time < 0) { role.time = 15; role.location = role.origin; save.achi_count++; save.loaction = role.location; } } if (ks.IsKeyDown(Keys.Left) | ks.IsKeyDown(Keys.A)) { role.backword = true; if (role.motion.x > -dx) { role.motion.x -= 0.0008f; } role.index++; if (role.index >= 24) { role.index = 5; } } else if (ks.IsKeyDown(Keys.Right) | ks.IsKeyDown(Keys.D)) { role.backword = false; if (role.motion.x < dx) { role.motion.x += 0.0008f; } role.index++; if (role.index >= 24) { role.index = 5; } } else { role.motion.x = 0; role.index = 0; } if (role.motion.y > -0.022f) { role.motion.y -= 0.001f; } GetMotionLine(); CaculLand(); CaculNeedle(); float x = role.location.x + role.motion.x; if (x > -1 & x < 1) { role.location.x = x; } else if (x > 1) { if (save.level < maps.Length) { buff_t[0].reg = true; buff_t[0].text = "Die:" + save.die_count.ToString() + "\r\n" + "Archive:" + save.achi_count.ToString(); buff_t[0].screen_pos.X = screenX * 0.5f - 40; if (current.can == Canvas.Game) { save.level++; } else { game.execute = () => { GamePage.page.HideDeclare(); } }; LoadLayOut(maps[save.level]); save.loaction = role.origin; role.loc_back = role.origin; current.can = Canvas.Game; FileManage.SaveArichive(save); return; } } x = role.location.y + role.motion.y; if (x > -1 & x < 1) { role.location.y = x; } GetPoints(role.location, ref role.points); int c = role.index / 5; Vector2 v = Vector2.Zero; v.X = c * 0.1666666f; if (role.backword) { SetTex_Pos(ref buff_img[role.imgid].vertex, 0, v); CaculRect_Pos(ref buff_img[role.imgid].vertex, role.location, 0.05625f, 0.1f, 0); } else { SetTex_PosA(ref buff_img[role.imgid].vertex, 0, v); CaculRect_PosA(ref buff_img[role.imgid].vertex, role.location, 0.05625f, 0.1f, 0); } }