I had red lasers, but it didn't fit the blue lights in the turrets. I'll probably add multiple colors and change them when upgrading the turrets ;). Easy eyecandy and play-motivation.


[recipee]

Now it's time for 2D animations!

Needed:

  • string manipulating functions.
  • Two string pointers and one panel pointer.
  • pan_create ánd pan_remove!
  • Your mind and a good mood! ha-ha-ha...



Define the two string and one panel pointer, then start a new function.

Take a long empty string. Build the string up like this:
"window (0,0,64,64,map_tga," + play_animation*64 + ", " + animation_frame*64 + "); flags=VISIBLE;"

Let the string process by a pan_create function and do this every frame (removing the old panel first).

play_animation is the animation you want to play (number from 0 to max_animations)
animation_frame is the frame of the animation you want to display (number from 0 to animation_length)

Now create a bitmap containing several rows of animations, each animation vertically displayed frame by frame.

graphical example and code sample:


 Code:
	//I'm not responsible for crashing your harddisk, use at own risk.
	str_cpy (tempstr, "window(0, 0, 64, 64, bmap_name, ");

	str_for_num (numstr, play_animation*64);
	str_cat (tempstr, numstr);
	str_cat (tempstr, ", ");

	str_for_num (numstr, animation_frame*64);
	str_cat (tempstr, numstr);
	str_cat (tempstr, "); flags=VISIBLE;");

	pan_remove(enemyPanel); //delete the older version of the enemy
	enemyPanel = pan_create(tempstr, 10); //display a new frame


I am sure you have enough information now to figure out yourself! Go ahead, make your own marvelous 2d games, and make me proud!

[/recipee]


Click and join the 3dgs irc community!
Room: #3dgs