Bullet Hell RPG
This Bullet Hell RPG was a team project in which Tommy Steenrod contributed all of the programming, and game design. Most of the gameplay systems were based on the game "Nuclear Throne". The primary game systems include:
- Player Movement
- Item Pickups
- Enemy AI
- Randomized Levels & Item Drops
- Simple RPG Elements
Code Examples
///approach player if (state = 1) { if (point_distance(obj_player.x,obj_player.y,x,y) > combatDistance) { state = 0; stateVerb = " "; } else if (point_distance(obj_player.x,obj_player.y,x,y) > attackDistanceMax) { mp_potential_step_object(obj_player.x,obj_player.y,moveSpeed,obj_wall) stateVerb = "approach" ; } else if (point_distance(obj_player.x,obj_player.y,x,y) < attackDistanceMin) { mp_potential_step_object(obj_player.x,obj_player.y,-moveSpeed,obj_wall) stateVerb = "flee"; } else { state = 2; stateVerb = " " } } ///combat if (state = 2) { //revert to approach state if not in attack range if (point_distance(x,y,obj_player.x,obj_player.y) > attackDistanceMax) || (point_distance(x,y,obj_player.x,obj_player.y) < attackDistanceMin) { state = 1; } attackTimer--; //attack player, reset attack timer, and possibly reposition if (attackTimer <= 0) { instance_create(x,y,obj_enemyBullet); attackTimer = irandom_range(10,20); if (irandom(2) == 2) { ignore = 1; state = 0; } else { state = 3; } } } ///reposition if (state = 3) { randomize(); repoTimer--; waitTimer--; if (repoTimer <= 0) { repoTimer = 128; state = 2; } //revert to approach state if not in attack range /*if (point_distance(x,y,obj_player.x,obj_player.y) > attackDistanceMax) || (point_distance(x,y,obj_player.x,obj_player.y) < attackDistanceMin) { state = 1; }*/ //get random nearby position if (idleSwitch1 = 0) { idleX = (irandom_range(-idleDistance * 2,idleDistance * 2) + x); idleY = (irandom_range(-idleDistance * 2,idleDistance * 2) + y); //if there is no wall at random position if (!instance_position(idleX,idleY,obj_wall)) { idleSwitch1 = 1; } } if ((x != idleX) && (y != idleY)) { mp_potential_step(idleX,idleY,moveSpeed*0.75,false); idleSwitch1 = 0; } else { if (waitTimer <= 0) { waitTimer = irandom(128) state = 2; } } }
State machine for generic enemy.