Open Surge Forum

A fun 2D retro platformer inspired by Sonic games and a game creation system

You are not logged in.

Announcement

Our community has moved to Discord! https://discord.gg/w8JqM7m

#1 2012-11-06 00:31:38

Alexander Gutiérrez
Member
Registered: 2012-11-02
Posts: 3

Boost and Homing attack?

Hello i'm Alexander Gutierrez.
I'm from Uruguay lol


I was making a hack of this game called Open Sonic Generations
In Sonic Generations Real can do the boost and homing attack.
I wonder if changing the sprites could be.
Thank you and respond

Offline

#2 2012-11-06 14:10:10

MatheusRRR
Member
From: Rio de Janeiro, Brazil
Registered: 2012-10-05
Posts: 335
Website

Re: Boost and Homing attack?

Alexander Gutiérrez wrote:

Hello i'm Alexander Gutierrez.
I'm from Uruguay lol


I was making a hack of this game called Open Sonic Generations
In Sonic Generations Real can do the boost and homing attack.
I wonder if changing the sprites could be.
Thank you and respond

you want to do homing attack and boost?

Offline

#3 2012-11-11 01:31:48

S32X
Member
From: Rochester, New York
Registered: 2012-03-18
Posts: 880
Website

Re: Boost and Homing attack?

They're both really good moves. Thugh they would be very hard to script.

Offline

#4 2012-11-11 13:40:47

KZR
Member
Registered: 2010-07-14
Posts: 1,447
Website

Re: Boost and Homing attack?

the only way i see a homing attack possible, is when it is ready to be performed, all enemies on screen compare their positions to the player, and the closest one gets homed in. might be hard to do though...


SD_sml.pngSeD_sml.pngLTot_W_sml.png
https://discord.gg/w8JqM7m ---> Open Surge's Discord server

Offline

#5 2012-11-11 17:46:44

svgmovement
Member
Registered: 2011-11-24
Posts: 209

Re: Boost and Homing attack?

Hey all,

I have two ideas: an object property targetable
and a function target_list that returns an array.

object some_object
{
    targetable
    ...
    state "main" {
        $enemylist = target_list();
        //iterate over the list
        ...
    }
}

An ideal convenience function would be nearest_target.

Would the engine even allow that?


-- svgmovement

Offline

#6 2012-11-11 20:56:35

lunarrush
Member
Registered: 2010-05-13
Posts: 278

Re: Boost and Homing attack?

svgmovement wrote:

Hey all,

I have two ideas: an object property targetable
and a function target_list that returns an array.

object some_object
{
    targetable
    ...
    state "main" {
        $enemylist = target_list();
        //iterate over the list
        ...
    }
}

An ideal convenience function would be nearest_target.

Would the engine even allow that?

It might, however you must consider this could have unfortunate implications for bugs.  For example, let's say you have a field where there is an enemy moving through the brick below the player and one in front of him on a hill.  If it locked onto and hit the enemy inside the brick you have effectively created a bug by letting the player get into the middle of a brick.  I'm not sure how the engine handles that, but it could potentially result in some very broken gameplay.  Also, angles have caused odd bugs in the past for me as well.  I am not certain how they would handle having the player hit them at a really high speed from an unexpected angle.  Not to mention the kind of slowdown that could be introduced if that array was not handled entirely correctly.
Overall I say it would be a hard task to write and an even harder one to bugfix.  The Boost shouldn't be too terribly difficult, just have it set player's x speed to a certain negative amount if the player is facing left or a certain positive amount if the player is facing right.  Then, put in a variable to track how much boost power they have left and another variable that disables it altogether so that you can put in cliffs and stuff that they aren't just going to keep going right or left on.  In fact, you could set a whole ton of variables that allow for different x,y speed combinations, the more complex you get though the more objects it will require to set and manage various boost types.
Good luck :-).


If I knew then what I know now I'd tell you that the story's true.  Cause whatever you do, it comes back to you.  -Slaughter, Burning Bridges

Offline

#7 2012-12-29 15:48:54

jobromedia
Member
From: Stockholm, Sweden
Registered: 2009-11-01
Posts: 1,072
Website

Re: Boost and Homing attack?

That bug could be easily fixed if we had

if_object_overlaps_brick(objid, state)
if_object_inside_brick(objid, state)

Offline

#8 2012-12-29 20:56:30

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Boost and Homing attack?

oh, a homming attack could be made by using a simple trick.

1. let's say that all enemies spawn a hidden object, ".enemy.position_exporter", that is always attached to them. You can attach it by asking each parent object (the enemies) what their position is.

2. when the player is to launch the homming attack, you

change_closest_object_state ".enemy.position_exporter" "@get_position"

3. then, the hidden object exports its position to global variables and

return_to_previous_state

4. now the player already knows the position of the closest enemy. You do the rest.

tada! smile

Offline

#9 2012-12-29 21:47:40

lunarrush
Member
Registered: 2010-05-13
Posts: 278

Re: Boost and Homing attack?

Alex, how can we ask the parent what its position is without state changes that break the object's flow?  I can see how it could be done if we could call parent_x() and parent_y(), but I also know how much work it would be for the engine to maintain such a big table if the number of enemies got too large in a level.


If I knew then what I know now I'd tell you that the story's true.  Cause whatever you do, it comes back to you.  -Slaughter, Burning Bridges

Offline

#10 2012-12-29 21:57:57

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Boost and Homing attack?

it's pretty easy. When you call change_parent_state, change_child_state or change_closest_object_state, the code of the state of the other object (parent/child/closest) will be executed immediately. If, by the end of that state, you call return_to_previous_state, then the object's flow is unmodified.

This is pretty much like a function call, in imperative programming languages.

You don't need parent_x(), nor parent_y(). You just need to export parent's xpos() and ypos() to global variables, and then return_to_previous_state. I'm using this technique in some of my scripts.:)

Offline

#11 2013-03-19 18:37:09

IamTheUltimateSonicForm
Member
From: ???
Registered: 2013-03-18
Posts: 8

Re: Boost and Homing attack?

How would this work, It was probably hard enough for sega, plus, homing attack wouldn't really work for a classic style game.


Sonic: What does heya mean???
Tails: It means Hel...
Sonic: Shut it Tails!
Tails: Ok, I'll just talk to my real friend. He's a mutant wisp you know!

Offline

#12 2013-03-29 20:09:10

S32X
Member
From: Rochester, New York
Registered: 2012-03-18
Posts: 880
Website

Re: Boost and Homing attack?

IamTheUltimateSonicForm wrote:

How would this work, It was probably hard enough for sega, plus, homing attack wouldn't really work for a classic style game.

Meh, I don't think so, I think it's a really cool move and should've been in the classic games

Offline

#13 2013-04-05 00:54:11

aronthehedgehog
Member
From: Lincoln, NE
Registered: 2013-04-05
Posts: 390

Re: Boost and Homing attack?

KZR wrote:

the only way i see a homing attack possible, is when it is ready to be performed, all enemies on screen compare their positions to the player, and the closest one gets homed in. might be hard to do though...

yes very i had my self make a object called doom it's a basic object though
object "DOOM"
{
    always_active
   
        State "main"
        {
        set_animation "SD_EXPLOSION2" 0
        on_player_collision hit_player
        change_state "protected"
        }
       
    state "protected"
        {
        if $x==1 give_rings
        Change_state "main"
        }


    state "hit_player"
        {
        hit_player
        Change_state "main"
        }

    state "destroy"
        {
        destroy
        }

    state "disable"
        {
        Change_state "destroy"
        }

}

well that's how you make 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

#14 2013-04-05 20:04:09

MatheusRRR
Member
From: Rio de Janeiro, Brazil
Registered: 2012-10-05
Posts: 335
Website

Re: Boost and Homing attack?

Error in script.
where is the state "give_rings"? wink

Offline

#15 2013-04-06 12:13:03

KZR
Member
Registered: 2010-07-14
Posts: 1,447
Website

Re: Boost and Homing attack?

also, you have not defined $x, you should declare a variable before calling it.

example:

let $x = 0

if $x == 1 next_state

SD_sml.pngSeD_sml.pngLTot_W_sml.png
https://discord.gg/w8JqM7m ---> Open Surge's Discord server

Offline

#16 2013-04-08 19:25:05

aronthehedgehog
Member
From: Lincoln, NE
Registered: 2013-04-05
Posts: 390

Re: Boost and Homing attack?

uhh... i do not know where that came from
but here is a example

"attack"
   (
      on player jump "homing"
      change state "disable"
  state "disable"
   (
      disable
   )
   
   state "homing"
   (
      attach to player
   )



so that is my solution try to finish it but i would NOT recommend to copy this it is a example.


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

#17 2013-04-20 07:13:44

aronthehedgehog
Member
From: Lincoln, NE
Registered: 2013-04-05
Posts: 390

Re: Boost and Homing attack?

ok so use a object that target's the enemy and use the exporter so by using the target sprite by silverstepP
you can target the enemy and thus homing attack see


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

#18 2013-04-21 17:45:29

S32X
Member
From: Rochester, New York
Registered: 2012-03-18
Posts: 880
Website

Re: Boost and Homing attack?

What? That made no sense. Can you try to use better punctuation so we could understand better? smile

Offline

#19 2013-04-21 21:05:18

aronthehedgehog
Member
From: Lincoln, NE
Registered: 2013-04-05
Posts: 390

Re: Boost and Homing attack?

i had spoken like that and it does not make any sense my sisters and brother can not even hear what i say
ok if on any matter to do this use the object location exporter like alex. was talking about so use a targeting sprite
and so when the enemy gets closer jump and the object which is attached to the player gets going causing homing attack


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

#20 2013-06-04 15:27:08

aronthehedgehog
Member
From: Lincoln, NE
Registered: 2013-04-05
Posts: 390

Re: Boost and Homing attack?

so actuator ---------  movement example "xsonic = 50" ysonic = 50
------------------------------------------------------------------------------------------
so then add that up he goes 50 in a diagonal motion
also.
-------------------------------------------------------------------------
actuator ----------------------------  homing attack
movement----------/
attach--------------/


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

#21 2013-07-11 20:59:00

aronthehedgehog
Member
From: Lincoln, NE
Registered: 2013-04-05
Posts: 390

Re: Boost and Homing attack?

here is something like boost first put this into there.

inputmap "default"
{
    keyboard
    {
        up              KEY_UP         // up arrow key
        right           KEY_RIGHT      // right arrow key
        down            KEY_DOWN       // down arrow key
        left            KEY_LEFT       // left arrow key
        fire1           KEY_SPACE      // space bar (jump)
        fire2           KEY_LCONTROL   // left ctrl (switch character)
        fire3           KEY_ENTER      // enter (pause game)
        fire4           KEY_ESC        // escape (leave game)
        fire5           KEY_C          // extra
        fire6           KEY_V          // kick
        fire7           KEY_X         // s
        fire8           KEY_B         // boost (certain chr.)
    }

then go to the objects folder go to sonic inc/obj
then enter...

object ".sonic_boost_controller"
{
    requires 0.2.0
    always_active
    hide_unless_in_editor_mode
    state "main"    
    {
        hide
        set_animation "SD_sonic" 1
        observe_player "sonic"
        change_state "ready"
    }
    state "ready"
    {
        on_button_down "fire8" "hit"
        change_state "main"
    }
    state "hit"
    {
        let "$direction = player_direction()"
        on_timeout 0.175 "go"
    }
    state "go"
    {
        if "$direction == -1" "left"
        if "$direction == 1" "right"
        change_state "main"
    }
    state "right"
    {
            simulate_button_up "left"
        simulate_button_down "right"
        set_player_xspeed 1000
        change_state "main"
    }
    state "left"
    {
           simulate_button_up "right"
        simulate_button_down "left"
        set_player_xspeed -1000
        change_state "main"
    }
}

then add at the top of the file enter...

object ".sonic_companion"
{
    requires 0.2.0
    always_active

    state "main"
    {
        create_child ".sonic_spindash_controller"
        create_child ".sonic_nolightwalk_controller"
        create_child ".sonic_boost_controller"
        destroy
    }
}

so if this doesn't work then oh well...


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

Board footer

Powered by FluxBB  hosted by tuxfamily.org