Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gdevelop5:objects:sprite [2019/07/03 04:28]
piyushpalawat99 [Collision and points]
gdevelop5:objects:sprite [2021/04/06 10:43] (current)
midhil457 [Creating a sprite object]
Line 7: Line 7:
 Sprite objects are the most often used objects in GDevelop. Sprite objects are the most often used objects in GDevelop.
  
-A sprite object allows us to display an image or to play a series of images as an animation. It can be used for many things in our games like buttons, characters or platforms. Anything that can be represented with an image can be a sprite object.+A sprite object allows us to display an image or play a series of images as an animation. It can be used for many things in our gameslike buttons, characters or platforms. Anything that can be represented with an image can be a sprite object.
  
 ## Creating a sprite object ## Creating a sprite object
  
-In order to add a sprite to your scene, select the "Click to add an object" option located on the right at the bottom of the Objects list.+To add a sprite to your scene, select the "Click to add an object" option located on the right at the bottom of the Objects list.
  
 {{ :gdevelop5:objects:clicktoaddanobject.png |}} {{ :gdevelop5:objects:clicktoaddanobject.png |}}
Line 17: Line 17:
 A new panel will open that will show the different types of objects available in GDevelop. A new panel will open that will show the different types of objects available in GDevelop.
  
-{{ :gdevelop5:tutorials:platform-game:gd5_object_types1.png |}}+{{:gdevelop5:objects:object_list.png|}}
  
 Choose "Sprite" from the list to create a new sprite object in your game scene. Choose "Sprite" from the list to create a new sprite object in your game scene.
Line 43: Line 43:
 {{ :gdevelop5:objects:add-symbol.png?nolink |}} {{ :gdevelop5:objects:add-symbol.png?nolink |}}
  
-This will open the file explorer so that you can browse through the files and choose a suitable image for your animation. After choosing the image, you will see the image being displayed in the window.+This will open the file explorer to browse through the files and choose a suitable image for your animation. After choosing the image, you will see the image being displayed in the window.
  
 {{ :gdevelop5:objects:add-image.png?nolink |}} {{ :gdevelop5:objects:add-image.png?nolink |}}
Line 49: Line 49:
 ### Collision and points ### Collision and points
  
-You can customise the collision area of your sprite using the Edit Hitboxes at the bottom of the dialog. In this, you can set the area to be taken into consideration during a collision. You can [[gdevelop5:objects:sprite:collision-mask|read more about collision masks here.]]+You can customise your sprite'collision area using the Edit Hitboxes at the bottom of the dialogyou can set the area to be taken into consideration during a collision. [[gdevelop5:objects:sprite:collision-mask|Read more about collision masks here.]]
  
 Beside the Edit Hitboxes option, you will find the Edit Points option at the bottom of the sprite properties dialog. This option allows us to have additional reference points for an object. These reference points can be used in events when needed. [[gdevelop5:objects:sprite:edit-points|Read more about points in sprites here.]] Beside the Edit Hitboxes option, you will find the Edit Points option at the bottom of the sprite properties dialog. This option allows us to have additional reference points for an object. These reference points can be used in events when needed. [[gdevelop5:objects:sprite:edit-points|Read more about points in sprites here.]]
Line 55: Line 55:
 ### Adding multiple animations ### Adding multiple animations
  
-An object might sometimes require to have more than one animations. To add animations, click the "Add animation" button in the same way that we did it the first time. This feature allows us to easily separate the different animations.+An object might sometimes require more than one animation. To add animations, click the "Add animation" button in the same way that we did it the first time. This feature allows us to separate the different animations easily
  
 {{ :gdevelop5:objects:multiple_animations.png?nolink |}} {{ :gdevelop5:objects:multiple_animations.png?nolink |}}
Line 67: Line 67:
 {{ :gdevelop5:objects:name-animation.png?nolink |}} {{ :gdevelop5:objects:name-animation.png?nolink |}}
  
-<note tip>In objects with multiple animations, you may find it difficult to differentiate between animations without names. It is generally a good practice to use animation name for objects with multiple animations.+<note tip>In objects with multiple animations, you may find it difficult to differentiate between animations without names. It is generally a good practice to use animation names for objects with multiple animations.
  
-If we don't enter a name we need to use the animation number to refer to this animation.</note>+If we don't enter a namewe need to use the animation number to refer to this animation.</note>
  
 ###Adding multiple images in an animation ###Adding multiple images in an animation
Line 81: Line 81:
 ### Repeating the animation ### Repeating the animation
  
-By default, every animation plays only once, which means that the animation stops as soon as its last frame finishes. To repeat the animation, we can "loop" the animation. We can set the animation to "loop" by clicking the repeat icon.+By default, every animation plays only once, which means that the animation stops as soon as its last frame finishes. To repeat the animation, we can "loop" the animationset the animation to "loop" by clicking the repeat icon.
  
 {{ :gdevelop5:objects:set-animation-loop.png?nolink |}} {{ :gdevelop5:objects:set-animation-loop.png?nolink |}}
  
-Once an animation is set to loop, it is going to play continuously.+Once an animation is set to loop, it will play continuously.
  
 ### Setting animation time ### Setting animation time
Line 93: Line 93:
 {{ :gdevelop5:objects:set-animation-speed.png?nolink&200 |}} {{ :gdevelop5:objects:set-animation-speed.png?nolink&200 |}}
  
-The value entered in the field is the time elapsed between two consecutive frames. The default value is 0.08 seconds. For faster playback use lower animation time while, for slower playback, use high animation time+The value entered in the field is the time elapsed between two consecutive frames. The default value is 0.08 seconds. For faster playbackuse lower animation time while, for slower playback, use high animation time.
  
 ## Naming the object ## Naming the object
Line 103: Line 103:
 ## Adding object to the scene ## Adding object to the scene
  
-To add the sprite object to our scene just select it and click in the scene to add an instance of the object to our scene.+To add the sprite objectselect it and click in the scene to add an object.
  
-Your new sprite is now complete, but you still need to add it to your game scene. Click on the new sprite in the Object list. Next, click on the scene where you want to add the sprite. You will now see your sprite added to the scene. You can add multiple "instances" of your sprite to your game screen. Simply repeat the process for adding the first sprite. +Your new sprite is now complete, but you still need to add it to your game scene. Click on the new sprite in the Object list. Next, click on the scene where you want to add the sprite. You will now see your sprite added to the scene. You can add multiple "instances" of your sprite to your game screen. Repeat the process for adding the first sprite. 
  
 {{ :gdevelop5:objects:addspritetoscene.gif |}} {{ :gdevelop5:objects:addspritetoscene.gif |}}
Line 117: Line 117:
 //Do not use negative values.//</note>  //Do not use negative values.//</note> 
  
-When you have set multiple animations for an object, you can use the events tab to "Change the animation (by name)". This is controlled in the "Add action" section of the condition. It will allow you to switch to the correct animation whenever the condition used in the "Add condition" section is true. +When you have set multiple animations for an object, you can use the events tab to "Change the animation (by name).This is controlled in the "Add action" section of the condition. It will allow you to switch to the correct animation whenever the condition used in the "Add condition" section is true. 
  
 {{ :gdevelop5:objects:eventanimationexample.png?nolink |}} {{ :gdevelop5:objects:eventanimationexample.png?nolink |}}