You are not logged in.
Pages: 1
he make you fly
btw thanks to to Spectrus for helping me code + btw happy bday Spectrus
spr code sprite "neo"
{
source_file "images/neo.png"
source_rect 0 0 44 44
frame_size 44 44
hot_spot 8 8
// all
animation 0
{
repeat TRUE
fps 6
data 0
}
}
ss code // Script created by Spectrus //
using SurgeEngine.Transform;
using SurgeEngine.Actor;
using SurgeEngine.Player;
using SurgeEngine.Behaviors.Platformer;
object "neo" is "entity", "awake" // The awake component allows scripts to run even if the entity is offscreen. //
{
transform = Transform();
actor = Actor("neo");
Direction = 1; // This will be the default direction. //
PlayerPos = Player.active.transform.position; // This is the variable that defines the player position. //
PlayerThrown = 0; // If the player has been thrown, this variable will be set to 1. //
platformer = Platformer(); // This will give the entity gravity. //
state "main" // EVERY object in Open Surge MUST have a main state. It is the state that the entity will spawn with. //
{
Distance = transform.position.distanceTo(PlayerPos); // This variable defines the distance between the player and the entity. //
if(Direction == 1) // If the direction variable is 0, disable hflip. //
{
actor.hflip = false;
}
if(Direction == -1) // If the direction variable is 1, enable hflip. //
{
actor.hflip = true;
}
if(Distance < 100) // If the distance variable is under 100, it will throw the player. [You may feel free to change the number to your liking.] //
{
state = "throwplayer";
}
}
state "throwplayer"
{
if(PlayerThrown == 0) // If the player hasn't been thrown yet, throw them and set the PlayerThrown variable to 1. //
{
Player.active.xsp = 500 * Direction; // This is how far horizontally the player will be thrown. The number is multiplied by the direction of the entity to define which way the player will be thrown, based on the direction of the entity. [Feel free to change the number.] //
Player.active.ysp = -500; // This is how high vertically the player will be thrown. [Feel free to change the number.] //
PlayerThrown = 1;
}
if(PlayerThrown == 1) // If the player has been thrown, play their hurt animation. [The hurt animation can vary. 11 is the hurt animation for Sonic in Sonic Surge. It may be different for your game, so check your character's .spr file to see what number is their hurt animation.] //
{
Player.active.anim = 11;
Player.active.springify(); // This will make the player unroll from a spin or jump state, making them vulnerable to enemies. //
Player.active.hlock(0.1); // This will make the player unable to move until they land on the ground. //
}
if(!Player.active.midair && PlayerThrown == 1) // If the player is on the ground, and if PlayerThrown is still set as 1, reset the variable back to 0 and go back to the main state. //
{
PlayerThrown = 0;
state = "main";
}
}
}
ps just make the neo.png sprite anything you wan't
Offline
hey sorry guys i forgot
to put the spr file sorry
sprite "neo"
{
source_file "images/neo.png"
source_rect 0 0 44 44
frame_size 44 44
hot_spot 8 8
// all
animation 0
{
repeat TRUEa
fps 6
data 0
}
}
Offline
Pages: 1