Jump to content


darthlupi

Member Since 06 Oct 2003
Offline Last Active Jan 19 2016 11:59 AM

Topics I've Started

sprite_create_from_surface style sprite explosion

30 August 2014 - 08:09 PM

I'm writing a very simple shooter, and I wanted to come up with a fun method of procedurely animating enemy deaths.

 

One of my favorite methods I have seen to create procedural death is to create small bitmaps from a large bitmap and make them explode or collapse.  It makes it look like the sprite is desintigrating.  It is awesome.

 

Capture1.PNG

 

Capture2.PNG

Now, the closest I have found to a bitmap copy function or anything speedy like that in gm is the sprite_create_from_surface.  I believe the create sprite portion of the function is pretty slow, so it really doesn't lend itself to action portions of a game, and exploding several baddies at once will have a huge cost in terms of CPU cycles.  Plus, this seems to just malfunction in HTML 5.

 

Once the sprite are created, having all of the objects with the sprites assigned too them causes no real slowdown.

 

Here is the script I wrote to get this effect:

//The purpose of this script is to create sprites out of other sprites, or little chunks
//Script name = scp_create_chunks
//Chunk size
chunk_sprite = argument0;
chunk_size = argument1;
chunk_x_org = argument2;
chunk_y_org = argument3;


chunk_r = floor( sprite_get_height(chunk_sprite) / chunk_size );
chunk_c = floor( sprite_get_width(chunk_sprite) / chunk_size );

//Create the surface to draw the sprite we will be creating chunks from
chunk_surf = surface_create(sprite_get_width(chunk_sprite), sprite_get_height(chunk_sprite));
surface_set_target(chunk_surf);
//Clear and draw to the surface
draw_clear_alpha(c_blue, 0);
draw_sprite(chunk_sprite, 0, sprite_get_xoffset(chunk_sprite), sprite_get_yoffset(chunk_sprite));

for ( rr = 0;rr < chunk_r;rr+=1)
{
    for ( cc = 0;cc < chunk_c;cc+=1)
    {
        chunk = instance_create(chunk_x_org + cc * chunk_size,chunk_y_org +rr * chunk_size,obj_chunk )
        chunk.sprite_index = sprite_create_from_surface(chunk_surf,cc * chunk_size,rr * chunk_size, chunk_size, chunk_size, false, false, 0, 0);    
        chunk.speed = random(0.4);
        chunk.direction = random(360);
    }
}

surface_reset_target();
surface_free(chunk_surf);

Here is an example of calling the script from an enemy object on collision with the player object:

scp_create_chunks(sprite_index,2,x - sprite_xoffset,y - sprite_yoffset);

If for what ever reason you want to recreate this effect at home you need to create an object named obj_chunk.

 

Now, there has to be a more efficient way to create sprites on the fly that this.  I just haven't thought of it yet.  That doesn't mean you genious folks in the Advanced Users forum haven't. 

 

Any ideas or insites would be quite interesting and appreciated.

 

 


Cole

08 May 2014 - 05:26 PM

The young wizard Cole searches the universe for The Curse that stole his family and all of his kind.  He is not alone in his quest.  He has his dog and self proclaimed master Draffut, and as he travels and and unravels the curse he frees more and more of his people as well as his family.  At least, that is what he hopes for.

The odds are stacked way against him, and as he starts out his powers are not fully realized.  With your help and the spells he learns along the way there may be a chance.

progress1.png

The game is played by first selecting the order you will be firing your spells:

drag_drop.gif

Then click the big GO! and start using those spells on the enemies.  

game_play.gif

There will be upgrades, leveling, a magical restaurant and many fun levels to play.  
I will post a todo list soon.

Link to play HTML5 version:
http://www.lupigames...ML5_TESTS/Cole/

Target Platform:

HTML5

Android

 

Team:

Currently it is just me coding and spriting.
I may have a musician, but it is a little up in the air.
It would be fun to see if another pixel artist wanted to play with the pixels.


Let me know the following:

1. Is the balance between shooting and dodging too far off?  I feel like it is a good risk reward mechanism, but I feel like it still needs some tweaking to flow properly.

2. Anything that you would like to see added or comment on.


Beta Bug - Draw_Sprite_ext with non-white color

23 September 2011 - 12:54 PM

Hey guys,

I get a "AW SNAP" warning ( browser crash ) from Chrome and just a plain old dead browser with FireFox with a test I ran last night.

I only see a problem when use the draw_sprite_ext function with a color other than white in the following examples:

With c_white as the blend color:
http://www.lupigames...L5_TESTS/test1/

With a random color:
http://www.lupigames...L5_TESTS/test2/

Here is the project for the failed experiment:

http://www.lupigames...CRandom.gmx.zip

Please let me know if this the wrong place for bug testing. I am simply experimenting with different base graphical effects and collisions at this point!

Thank you guys for being awesome,

darthlupi

Tile Matrix - Cool stuff

27 April 2011 - 07:38 PM

Hello ladies and gents,

I was wondering how many of you are aware of little awesome thing for level editing or room editing called tile matrix?

Basically allows you create a palette of tiles that will auto draw your tiles depending on how you have them laid out. It is auto tiling at it's finest!

Here is a little Adobe Air app that makes amazing use of this:

http://dambots.com/dame-editor/

This site includes videos as well as the easy to install app.


I know this isn't the place to put forth feature requests etc, but I was wondering if anyone else thought this would be useful in Game Maker? For games that are tiled this is a huge time saver!

Later,

Robert Lupinek aka darthlupi

--*blade Gardener*--

18 February 2009 - 02:47 AM

GM Version: GM7
Present Status: Tech Demo

Hello,

I just wanted to spit a little tech demo you guys way. The concept as of now is that you are a gardener in the garden of life who has has to fend off and invasion from the land of decay. You see, the Goddess of Decay is jealous of her place in the cycle and wants to become the Goddess of life as well.

It is solely up to you to stop the cycle from life and death from being forever disrupted. To accomplish this you have to destroy the mechanisms of decay put in place around the garden. You destroy them by collecting the energies of decay and converting them into a beam of pure life light to crack through their defenses.

As of right now there is combat, basic leveling up, and dark crystals to beam into life!

Posted Image

Posted Image



Click below to download:
----DOWNLOAD HERE----

I am really curious to see what you guys get out of this little tech demo.

Main Game Goal:

The goal of the game is to purge the garden of the dark crystals that surround the life orbs.

1. To do that you have to kill baddies and steal their mana. ( round things left behind )
2. Then you have to take that mana and exchange the energy for life energy by getting close to a life orb. (Big white this is a life orb)
3. Repeat this until all the dark crystals are gone.

Help wanted:

1. I've included a new enemy the Decayor. They are basically going around killing your flowers and destroying you charging crystals. I am not sure what effect the flowers should have? Should they just be a way to score points, or should it be more than that?

Controls:

Arrow Keys OR Left Mouse to move
Left mouse and mouse cursor to move
Mouse to swing sword
Right mouse to throw sword

Middle Mouse or space mouse to beam.

WORD :blink: :P