You are not logged in.
Pages: 1
well someone requested a tails with some of his moves so i compiled this...
--------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// Open Surge Engine
// [url]http://opensnc.sourceforge.net[/url]
//
// File: default_companions/surge.inc
// Desc: tails companion
// Author: Alexandre
// Date: 2011-02-09, 2011-02-11, 2012-02-23
// ---------------------------------------------------------------------------
object ".tails_companion"
{
requires 0.2.0
always_active
state "main"
{
create_child ".tails_spindash_controller"
create_child ".tails_nolightwalk_controller"
create_child ".tails_flight_controller"
destroy
}
}
object ".tails_spindash_controller"
{
requires 0.2.0
always_active
state "main"
{
hide
observe_player "tails"
change_state "stand by"
}
state "stand by"
{
on_player_duck "duck"
}
state "duck"
{
let "$p = 0"
on_button_pressed "fire1" "charge"
on_player_duck "duck"
change_state "stand by"
}
state "charge"
{
set_player_animation "SD_tails" "6"
strong_player
springfy_player // so that the camera won't go down, since the player is ducking
disable_player_movement
play_sample "charge"
let "$p = min($p+2, 8)"
change_state "hold"
}
state "hold"
{
//textout menu.small 0 0 $p
set_player_animation "SD_tails" "6"
let "$p -= 0.234 * floor(8*$p) * dt()"
// check if there's a platform underneath the player
attach_to_player 0 20
unless "brick_exists(0,0)" "cancel"
// create cool particles
let "$_pixelparticle_anim = 1 + random(3)"
let "$_pixelparticle_xvel = -player_direction() * (120 + random(60))"
let "$_pixelparticle_yvel = -60 - random(120)"
create_child .pixelparticle -player_direction()*7 -2
let "$_pixelparticle_anim = 1 + random(3)"
let "$_pixelparticle_xvel = -player_direction() * (120 + random(60))"
let "$_pixelparticle_yvel = -60 - random(120)"
create_child .pixelparticle -player_direction()*7 -2
let "$_pixelparticle_anim = 1 + random(3)"
let "$_pixelparticle_xvel = -player_direction() * (120 + random(60))"
let "$_pixelparticle_yvel = -60 - random(120)"
create_child .pixelparticle -player_direction()*7 -2
// check if the user wants to charge more, or if we can release the player
on_button_pressed "fire1" "charge"
on_button_down "down" "hold"
change_state "release"
}
state "cancel"
{
enable_player_movement
weak_player
change_state "stand by"
}
state "release"
{
play_sample "release"
enable_player_movement
weak_player
set_player_xspeed "(480 + 30 * floor($p)) * player_direction()"
roll_player
change_state "stand by"
}
}
object ".tails_nolightwalk_controller" // his lighting sneakers can't shine when in the air
{
requires 0.2.0
always_active
state "main"
{
hide
observe_player "tails"
change_state "stand by"
}
state "stand by"
{
on_player_in_the_air "air"
}
state "air"
{
on_player_walk "walking in the air"
on_player_run "running in the air"
on_player_brake "braking in the air"
on_player_in_the_air "air"
change_state "stand by"
}
state "walking in the air"
{
on_player_spring "stand by"
on_player_jump "stand by"
on_player_gethit "stand by"
on_player_death "stand by"
set_player_animation "SD_tails" 1
on_player_in_the_air "walking in the air"
change_state "stand by"
}
state "running in the air"
{
on_player_spring "stand by"
on_player_jump "stand by"
on_player_gethit "stand by"
on_player_death "stand by"
set_player_animation "SD_tails" 1
on_player_in_the_air "running in the air"
change_state "stand by"
}
state "braking in the air"
{
on_player_spring "stand by"
on_player_jump "stand by"
on_player_gethit "stand by"
on_player_death "stand by"
set_player_animation "SD_tails" 7
on_player_in_the_air "braking in the air"
change_state "stand by"
}
}
object ".tails_flight_controller"
{
requires 0.2.0
always_active
state "main"
{
hide
observe_player "tails"
change_state "stand by"
}
state "stand by"
{
on_button_pressed "fire1" "standby2"
}
State "stand by2"
{
On_button_pressed "fire2" "fly1"
state "fly1"
{
set_player_animation "SD_tails" "20"
enable_player_movement
set_player_yspeed -100
on_button_pressed "fire2" "fly2"
weak_player
on_timeout 1 "tired"
}
state "fly2"
{
set_player_animation "SD_tails" "20"
enable_player_movement
set_player_yspeed -100
on_button_pressed "fire2" "fly3"
weak_player
on_timeout 1 "tired"
}
state "fly3"
{
set_player_animation "SD_tails" "20"
enable_player_movement
set_player_yspeed -100
on_button_pressed "fire2" "fly4"
weak_player
on_timeout 1 "tired"
}
state "fly4"
{
set_player_animation "SD_tails" "20"
enable_player_movement
set_player_yspeed -100
on_button_pressed "fire2" "fly5"
weak_player
on_timeout 1 "tired"
}
state "fly5"
{
set_player_animation "SD_tails" "20"
enable_player_movement
set_player_yspeed -100
on_button_pressed "fire2" "fly6"
weak_player
on_timeout 1 "tired"
}
state "fly6"
{
set_player_animation "SD_tails" "20"
enable_player_movement
set_player_yspeed -100
weak_player
on_button_pressed "fire2" "fly7"
}
state "fly7"
{
set_player_animation "SD_tails" "20"
enable_player_movement
set_player_yspeed -100
weak_player
on_button_pressed "fire2" "fly8"
}
state "fly8"
{
set_player_animation "SD_tails" "20"
enable_player_movement
set_player_yspeed -100
weak_player
on_button_pressed "fire2" "fly9"
}
state "fly9"
{
set_player_animation "SD_tails" "20"
enable_player_movement
set_player_yspeed -100
weak_player
on_button_pressed "fire2" "fly8"
}
state "fly10"
{
set_player_animation "SD_tails" "20"
enable_player_movement
set_player_yspeed -100
weak_player
change_state "tired"
}
state "tired"
{
set_player_animation "SD_tails" "19"
enable_player_movement
weak_player
gravity
change_state "stand by"
}
}
}
Not active much anymore.
The only things I do now is just let inspiration come to me when it's needed.
Also bad profile pic because I don't have anything else in mind.
Offline
That's nice. Moving this to game assets though since it fits better there. I also embeded your code in code blocks to make it easier to read.
Offline
I get:
nanoparser error! object script error: command parameters must be strings in "null" near line -1
I have a tails.chr, tails.spr so that it'll work but I keep getting this error
Edit: The error only appears if I play a level with tails in it.
Last edited by SuperSonicRacing (2013-06-22 17:15:39)
Offline
weird here is kinda weirder version though if you press the space bar once then he gets going press it several times to stop
object ".tails_companion"
{
requires 0.2.0
always_active
state "main"
{
create_child ".tails_spindash_controller"
create_child ".tails_nolightwalk_controller"
create_child ".tails_new_flight_controller"
destroy
}
}
object ".tails_spindash_controller"
{
requires 0.2.0
always_active
state "main"
{
hide
observe_player "tails"
change_state "stand by"
}
state "stand by"
{
on_player_duck "duck"
}
state "duck"
{
let "$p = 0"
on_button_pressed "fire1" "charge"
on_player_duck "duck"
change_state "stand by"
}
state "charge"
{
set_player_animation "SD_tails" "6"
strong_player
springfy_player // so that the camera won't go down, since the player is ducking
disable_player_movement
play_sample "charge"
let "$p = min($p+2, 8)"
change_state "hold"
}
state "hold"
{
//textout menu.small 0 0 $p
set_player_animation "SD_tails" "6"
let "$p -= 0.234 * floor(8*$p) * dt()"
// check if there's a platform underneath the player
attach_to_player 0 20
unless "brick_exists(0,0)" "cancel"
// create cool particles
let "$_pixelparticle_anim = 1 + random(3)"
let "$_pixelparticle_xvel = -player_direction() * (120 + random(60))"
let "$_pixelparticle_yvel = -60 - random(120)"
create_child .pixelparticle -player_direction()*7 -2
let "$_pixelparticle_anim = 1 + random(3)"
let "$_pixelparticle_xvel = -player_direction() * (120 + random(60))"
let "$_pixelparticle_yvel = -60 - random(120)"
create_child .pixelparticle -player_direction()*7 -2
let "$_pixelparticle_anim = 1 + random(3)"
let "$_pixelparticle_xvel = -player_direction() * (120 + random(60))"
let "$_pixelparticle_yvel = -60 - random(120)"
create_child .pixelparticle -player_direction()*7 -2
// check if the user wants to charge more, or if we can release the player
on_button_pressed "fire1" "charge"
on_button_down "down" "hold"
change_state "release"
}
state "cancel"
{
enable_player_movement
weak_player
change_state "stand by"
}
state "release"
{
play_sample "release"
enable_player_movement
weak_player
set_player_xspeed "(480 + 30 * floor($p)) * player_direction()"
roll_player
change_state "stand by"
}
}
object ".tails_nolightwalk_controller" // his lighting sneakers can't shine when in the air
{
requires 0.2.0
always_active
state "main"
{
hide
observe_player "tails"
change_state "stand by"
}
state "stand by"
{
on_player_in_the_air "air"
}
state "air"
{
on_player_walk "walking in the air"
on_player_run "running in the air"
on_player_brake "braking in the air"
on_player_in_the_air "air"
change_state "stand by"
}
state "walking in the air"
{
on_player_spring "stand by"
on_player_jump "stand by"
on_player_gethit "stand by"
on_player_death "stand by"
set_player_animation "SD_tails" 1
on_player_in_the_air "walking in the air"
change_state "stand by"
}
state "running in the air"
{
on_player_spring "stand by"
on_player_jump "stand by"
on_player_gethit "stand by"
on_player_death "stand by"
set_player_animation "SD_tails" 2
on_player_in_the_air "running in the air"
change_state "stand by"
}
state "braking in the air"
{
on_player_spring "stand by"
on_player_jump "stand by"
on_player_gethit "stand by"
on_player_death "stand by"
set_player_animation "SD_tails" 7
on_player_in_the_air "braking in the air"
change_state "stand by"
}
}
object ".tails_new_flight_controller"
{
requires 0.2.0
always_active
state "main"
{
hide
observe_player "tails"
change_state "stand by"
}
state "stand by"
{
on_player_jump "standbyphase"
}
state "standbyphase"
{
on_button_down "fire1" "fly"
}
state "fly"
{
set_player_animation "SD_tails" 20
set_player_yspeed -100
On_button_pressed "fire1" "flying in the air"
gravity
play_sample "tfly1"
}
state "flying in the air"
{
set_player_yspeed -100
set_player_animation "SD_tails" 20
Gravity
play_sample "tfly1"
On_button_pressed "fire1" "moving in the air"
}
state "moving in the air"
{
set_player_yspeed -100
set_player_animation "SD_tails" 20
Gravity
play_sample "tfly1"
On_button_pressed "fire1" "fly2"
}
state "fly2"
{
set_player_yspeed -100
set_player_animation "SD_tails" 20
Gravity
play_sample "tfly1"
On_button_pressed "fire1" "fly3"
}
state "fly3"
{
set_player_yspeed -100
set_player_animation "SD_tails" 20
Gravity
play_sample "tfly1"
On_button_pressed "fire1" "fly4"
}
state "fly4"
{
set_player_yspeed -100
set_player_animation "SD_tails" 20
Gravity
play_sample "tfly1"
On_button_pressed "fire1" "tired"
}
state "tired"
{
Gravity
Disable_player_movement
set_player_animation "SD_tails" 19
play_sample "tfly2"
on_timeout 0.5 "restore"
}
state "restore"
{
Gravity
enable_player_movement
on_timeout 1.5 "main"
}
state "gravity"
{
Gravity
change_state "tired"
}
}
Last edited by aronthehedgehog (2013-06-24 19:05:25)
Not active much anymore.
The only things I do now is just let inspiration come to me when it's needed.
Also bad profile pic because I don't have anything else in mind.
Offline
I'll have a play around and make some changes when I make a proper game, thanks.
Offline
well if u do not like my logic well then at least i tried
Not active much anymore.
The only things I do now is just let inspiration come to me when it's needed.
Also bad profile pic because I don't have anything else in mind.
Offline
maybe instead of on_player_jump you could use on_player_in_the_air. I think it would make more sense. then you could use a state with on_timeout to make him get tired after, for example, 10 seconds, regardless of key presses. also don't forget to reset the object once the player hits the ground. And I believe you don't need to disable the player movement, just an animation and change while the timeout is running is enough. or you could use a variable, like $_tails_flytime, set it to 10 (for 10 seconds) and then in the states where you fly and get impulse by pressing the jump button, use
let "$_tails_flytime -= dt()"
and end the state with
if "$_tails_flytime <= 0" "tired"
Last edited by KZR (2013-12-06 13:00:16)
https://discord.gg/w8JqM7m ---> Open Surge's Discord server
Offline
oh now i get it.
Not active much anymore.
The only things I do now is just let inspiration come to me when it's needed.
Also bad profile pic because I don't have anything else in mind.
Offline
Pages: 1