{ "firstLayout": "", "gdVersion": { "build": 274, "major": 5, "minor": 6, "revision": 0 }, "initialGDVersion": "5.6.274", "properties": { "adaptGameResolutionAtRuntime": true, "antialiasingMode": "MSAA", "antialisingEnabledOnMobile": false, "folderProject": false, "orientation": "landscape", "packageName": "com.example.gamename", "pixelsRounding": true, "projectUuid": "84c990c5-3f6f-4eda-be3c-0860bfe9e159", "scaleMode": "nearest", "sizeOnStartupMode": "adaptWidth", "templateSlug": "", "version": "1.0.0", "name": "GdevelopMMOTestv2", "description": "", "author": "", "windowWidth": 480, "windowHeight": 320, "latestCompilationDirectory": "", "maxFPS": 60, "minFPS": 20, "verticalSync": false, "platformSpecificAssets": { "android-icon-144": "", "android-icon-192": "", "android-icon-36": "", "android-icon-48": "", "android-icon-72": "", "android-icon-96": "", "android-windowSplashScreenAnimatedIcon": "", "desktop-icon-512": "", "ios-icon-100": "", "ios-icon-1024": "", "ios-icon-114": "", "ios-icon-120": "", "ios-icon-144": "", "ios-icon-152": "", "ios-icon-167": "", "ios-icon-180": "", "ios-icon-20": "", "ios-icon-29": "", "ios-icon-40": "", "ios-icon-50": "", "ios-icon-57": "", "ios-icon-58": "", "ios-icon-60": "", "ios-icon-72": "", "ios-icon-76": "", "ios-icon-80": "", "ios-icon-87": "" }, "loadingScreen": { "backgroundColor": 0, "backgroundFadeInDuration": 0.2, "backgroundImageResourceName": "", "gdevelopLogoStyle": "light", "logoAndProgressFadeInDuration": 0.2, "logoAndProgressLogoFadeInDelay": 0, "minDuration": 1.5, "progressBarColor": 16777215, "progressBarHeight": 20, "progressBarMaxWidth": 200, "progressBarMinWidth": 40, "progressBarWidthPercent": 30, "showGDevelopSplash": true, "showProgressBar": true }, "watermark": { "placement": "bottom-left", "showWatermark": true }, "authorIds": [], "authorUsernames": [], "categories": [], "playableDevices": [], "extensionProperties": [], "platforms": [ { "name": "GDevelop JS platform" } ], "currentPlatform": "GDevelop JS platform" }, "resources": { "resources": [ { "file": "assets/NewSprite.png", "kind": "image", "metadata": "{\"extension\":\".png\"}", "name": "NewSprite", "smoothed": false, "userAdded": false }, { "file": "assets/NewSprite2.png", "kind": "image", "metadata": "{\"extension\":\".png\"}", "name": "NewSprite2", "smoothed": false, "userAdded": false }, { "file": "Route101.png", "kind": "image", "metadata": "", "name": "Route101.png", "smoothed": false, "userAdded": false }, { "file": "assets/NewSprite3.png", "kind": "image", "metadata": "{\"extension\":\".png\"}", "name": "NewSprite3", "smoothed": false, "userAdded": false }, { "file": "assets/Sprites/Player/0.png", "kind": "image", "metadata": "", "name": "assets/Sprites/Player/0.png", "smoothed": false, "userAdded": false }, { "file": "assets/Sprites/Player/1.png", "kind": "image", "metadata": "", "name": "assets/Sprites/Player/1.png", "smoothed": false, "userAdded": false }, { "file": "assets/Sprites/Player/2.png", "kind": "image", "metadata": "", "name": "assets/Sprites/Player/2.png", "smoothed": false, "userAdded": false }, { "file": "assets/Sprites/Player/6.png", "kind": "image", "metadata": "", "name": "assets/Sprites/Player/6.png", "smoothed": false, "userAdded": false }, { "file": "assets/Sprites/Player/7.png", "kind": "image", "metadata": "", "name": "assets/Sprites/Player/7.png", "smoothed": false, "userAdded": false }, { "file": "assets/Sprites/Player/8.png", "kind": "image", "metadata": "", "name": "assets/Sprites/Player/8.png", "smoothed": false, "userAdded": false }, { "file": "assets/Sprites/Player/3.png", "kind": "image", "metadata": "", "name": "assets/Sprites/Player/3.png", "smoothed": false, "userAdded": false }, { "file": "assets/Sprites/Player/4.png", "kind": "image", "metadata": "", "name": "assets/Sprites/Player/4.png", "smoothed": false, "userAdded": false }, { "file": "assets/Sprites/Player/5.png", "kind": "image", "metadata": "", "name": "assets/Sprites/Player/5.png", "smoothed": false, "userAdded": false }, { "file": "assets/Maps/Kanto/WorldMap/PalletTown.png", "kind": "image", "metadata": "", "name": "assets/Maps/Kanto/WorldMap/PalletTown.png", "smoothed": false, "userAdded": false } ] }, "objects": [], "objectsFolderStructure": { "folderName": "__ROOT" }, "objectsGroups": [], "variables": [], "layouts": [ { "b": 255, "disableInputWhenNotFocused": true, "mangledName": "Game", "name": "Game", "r": 247, "standardSortMethod": true, "stopSoundsOnStartup": true, "title": "", "v": 249, "uiSettings": { "grid": true, "gridType": "rectangular", "gridWidth": 16, "gridHeight": 16, "gridDepth": 32, "gridOffsetX": 0, "gridOffsetY": 0, "gridOffsetZ": 0, "gridColor": 10401023, "gridAlpha": 0.8, "snap": true, "zoomFactor": 0.5117784035210186, "windowMask": false, "selectedLayer": "", "gameEditorMode": "instances-editor" }, "objectsGroups": [ { "name": "WorlMap", "objects": [ { "name": "spr_PalletTown" }, { "name": "spr_route101" } ] } ], "variables": [], "instances": [ { "angle": 0, "customSize": false, "height": 0, "keepRatio": true, "layer": "", "name": "spr_PalletTown", "persistentUuid": "8910ef5d-095c-4396-abbb-d825bf2436e8", "width": 0, "x": 0, "y": 0, "zOrder": 1, "numberProperties": [], "stringProperties": [], "initialVariables": [] }, { "angle": 0, "customSize": false, "height": 0, "keepRatio": true, "layer": "", "name": "spr_route101", "persistentUuid": "4e1f00f8-017b-40c2-ad0f-f8961304e632", "width": 0, "x": 0, "y": -640, "zOrder": 2, "numberProperties": [], "stringProperties": [], "initialVariables": [] }, { "angle": 0, "customSize": false, "height": 0, "keepRatio": true, "layer": "", "name": "spr_player", "persistentUuid": "a1c6b635-579d-4e16-954b-c6e6b2f9996f", "width": 0, "x": 176, "y": 144, "zOrder": 300, "numberProperties": [], "stringProperties": [], "initialVariables": [] } ], "objects": [ { "adaptCollisionMaskAutomatically": true, "assetStoreId": "", "name": "spr_PalletTown", "persistentUuid": "6aa6fe2d-5018-4105-9471-f36f6cf806f3", "type": "Sprite", "updateIfNotVisible": false, "variables": [], "effects": [], "behaviors": [], "animations": [ { "name": "NewSprite", "useMultipleDirections": false, "directions": [ { "looping": false, "metadata": "{\"pskl\":{}}", "timeBetweenFrames": 0.08, "sprites": [ { "hasCustomCollisionMask": true, "image": "assets/Maps/Kanto/WorldMap/PalletTown.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 0 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 0 }, { "x": 480, "y": 0 }, { "x": 480, "y": 640 }, { "x": 0, "y": 640 } ] ] } ] } ] } ] }, { "adaptCollisionMaskAutomatically": true, "assetStoreId": "", "name": "spr_route101", "persistentUuid": "29468b4b-b355-4ef6-bfe8-74179a6a17c2", "type": "Sprite", "updateIfNotVisible": false, "variables": [], "effects": [], "behaviors": [ { "name": "InOnScreen", "type": "IsOnScreen::InOnScreen" } ], "animations": [ { "name": "NewSprite", "useMultipleDirections": false, "directions": [ { "looping": false, "metadata": "{\"pskl\":{}}", "timeBetweenFrames": 0.08, "sprites": [ { "hasCustomCollisionMask": true, "image": "NewSprite3", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 0 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 0 }, { "x": 480, "y": 0 }, { "x": 480, "y": 640 }, { "x": 0, "y": 640 } ] ] } ] } ] } ] }, { "adaptCollisionMaskAutomatically": true, "assetStoreId": "", "name": "spr_player", "persistentUuid": "c77d303b-de93-4e1f-a666-515b30a83c2d", "type": "Sprite", "updateIfNotVisible": false, "variables": [], "effects": [], "behaviors": [ { "maxSpeed": 100, "name": "TopDownMovement", "type": "TopDownMovementBehavior::TopDownMovementBehavior", "acceleration": 999999, "allowDiagonals": false, "angleOffset": 0, "angularMaxSpeed": 180, "customIsometryAngle": 30, "deceleration": 999999, "ignoreDefaultControls": false, "movementAngleOffset": 0, "rotateObject": false, "useLegacyTurnBack": false, "viewpoint": "TopDown" } ], "animations": [ { "name": "01Down", "useMultipleDirections": false, "directions": [ { "looping": true, "timeBetweenFrames": 0.2, "sprites": [ { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/0.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] }, { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/1.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] }, { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/2.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] }, { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/1.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] } ] } ] }, { "name": "01Left", "useMultipleDirections": false, "directions": [ { "looping": true, "timeBetweenFrames": 0.2, "sprites": [ { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/6.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] }, { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/7.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] }, { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/8.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] }, { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/7.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] } ] } ] }, { "name": "02Up", "useMultipleDirections": false, "directions": [ { "looping": true, "timeBetweenFrames": 0.2, "sprites": [ { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/3.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] }, { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/4.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] }, { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/5.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] }, { "hasCustomCollisionMask": true, "image": "assets/Sprites/Player/4.png", "points": [], "originPoint": { "name": "origine", "x": 0, "y": 24 }, "centerPoint": { "automatic": true, "name": "centre", "x": 0, "y": 0 }, "customCollisionMask": [ [ { "x": 0, "y": 5 }, { "x": 15, "y": 5 }, { "x": 15, "y": 24 }, { "x": 0, "y": 24 } ] ] } ] } ] } ] } ], "objectsFolderStructure": { "folderName": "__ROOT", "children": [ { "folderName": "Maps", "children": [ { "folderName": "Kanto", "children": [ { "folderName": "WorldMap", "children": [ { "objectName": "spr_PalletTown" }, { "objectName": "spr_route101" } ] } ] } ] }, { "folderName": "Sprites", "children": [ { "folderName": "Player", "children": [ { "objectName": "spr_player" } ] } ] } ] }, "events": [ { "type": "BuiltinCommonInstructions::Link", "include": { "includeConfig": 0 }, "target": "Functions" } ], "layers": [ { "ambientLightColorB": 200, "ambientLightColorG": 200, "ambientLightColorR": 200, "camera2DPlaneMaxDrawingDistance": 5000, "camera3DFarPlaneDistance": 10000, "camera3DFieldOfView": 45, "camera3DNearPlaneDistance": 3, "cameraType": "", "followBaseLayerCamera": false, "isLightingLayer": false, "isLocked": false, "name": "", "renderingType": "", "visibility": true, "cameras": [ { "defaultSize": true, "defaultViewport": true, "height": 0, "viewportBottom": 1, "viewportLeft": 0, "viewportRight": 1, "viewportTop": 0, "width": 0 } ], "effects": [ { "effectType": "Scene3D::HemisphereLight", "name": "3D Ambient Hemisphere Light", "doubleParameters": { "elevation": 40, "intensity": 0.33, "rotation": 300 }, "stringParameters": { "groundColor": "127;127;127", "skyColor": "255;255;255", "top": "Z+" }, "booleanParameters": {} }, { "effectType": "Scene3D::DirectionalLight", "name": "3D Sun Light", "doubleParameters": { "distanceFromCamera": 1500, "elevation": 40, "frustumSize": 4000, "intensity": 0.75, "minimumShadowBias": 0, "rotation": 300 }, "stringParameters": { "color": "255;255;255", "shadowQuality": "medium", "top": "Z+" }, "booleanParameters": { "isCastingShadow": true } } ] } ], "behaviorsSharedData": [ { "name": "Animation", "type": "AnimatableCapability::AnimatableBehavior" }, { "name": "Effect", "type": "EffectCapability::EffectBehavior" }, { "name": "Flippable", "type": "FlippableCapability::FlippableBehavior" }, { "name": "InOnScreen", "type": "IsOnScreen::InOnScreen" }, { "name": "Opacity", "type": "OpacityCapability::OpacityBehavior" }, { "name": "Resizable", "type": "ResizableCapability::ResizableBehavior" }, { "name": "Scale", "type": "ScalableCapability::ScalableBehavior" }, { "name": "TopDownMovement", "type": "TopDownMovementBehavior::TopDownMovementBehavior" } ] } ], "externalEvents": [ { "associatedLayout": "Game", "name": "Functions", "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Camera", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "RoomBasedCameraMovement::MoveCameraToActiveRoom" }, "parameters": [ "", "WorlMap", "spr_player", "", "0", "3", "1", "0", "", "" ] } ] } ], "parameters": [] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Sprite Control", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl" }, "parameters": [ "spr_player", "TopDownMovement", "\"Down\"" ] }, { "type": { "value": "BuiltinCommonInstructions::Once" }, "parameters": [] } ], "actions": [ { "type": { "value": "FlippableCapability::FlippableBehavior::FlipX" }, "parameters": [ "spr_player", "Flippable", "no" ] }, { "type": { "value": "AnimatableCapability::AnimatableBehavior::SetName" }, "parameters": [ "spr_player", "Animation", "=", "\"01Down\"" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl" }, "parameters": [ "spr_player", "TopDownMovement", "\"Left\"" ] }, { "type": { "value": "BuiltinCommonInstructions::Once" }, "parameters": [] } ], "actions": [ { "type": { "value": "FlippableCapability::FlippableBehavior::FlipX" }, "parameters": [ "spr_player", "Flippable", "no" ] }, { "type": { "value": "AnimatableCapability::AnimatableBehavior::SetName" }, "parameters": [ "spr_player", "Animation", "=", "\"01Left\"" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl" }, "parameters": [ "spr_player", "TopDownMovement", "\"Right\"" ] }, { "type": { "value": "BuiltinCommonInstructions::Once" }, "parameters": [] } ], "actions": [ { "type": { "value": "FlippableCapability::FlippableBehavior::FlipX" }, "parameters": [ "spr_player", "Flippable", "yes" ] }, { "type": { "value": "AnimatableCapability::AnimatableBehavior::SetName" }, "parameters": [ "spr_player", "Animation", "=", "\"01Left\"" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl" }, "parameters": [ "spr_player", "TopDownMovement", "\"Up\"" ] }, { "type": { "value": "BuiltinCommonInstructions::Once" }, "parameters": [] } ], "actions": [ { "type": { "value": "FlippableCapability::FlippableBehavior::FlipX" }, "parameters": [ "spr_player", "Flippable", "no" ] }, { "type": { "value": "AnimatableCapability::AnimatableBehavior::SetName" }, "parameters": [ "spr_player", "Animation", "=", "\"02Up\"" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "inverted": true, "value": "TopDownMovementBehavior::IsMoving" }, "parameters": [ "spr_player", "TopDownMovement" ] } ], "actions": [ { "type": { "value": "ChangeSprite" }, "parameters": [ "spr_player", "=", "1" ] } ] } ], "parameters": [] } ] } ], "eventsFunctionsExtensions": [ { "author": "", "category": "Camera", "dimension": "2D", "extensionNamespace": "", "fullName": "Room-based camera movement", "gdevelopVersion": ">=5.5.222", "helpPath": "https://victrisgames.itch.io/room-based-camera-movement", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPGc+DQoJPHBhdGggZD0iTTE0LDNINEMzLjQsMywzLDMuNCwzLDR2MTBjMCwwLjYsMC40LDEsMSwxaDEwYzAuNiwwLDEtMC40LDEtMVY0QzE1LDMuNCwxNC42LDMsMTQsM3oiLz4NCgk8cGF0aCBkPSJNMTQsMTdINGMtMC42LDAtMSwwLjQtMSwxdjEwYzAsMC42LDAuNCwxLDEsMWgxMGMwLjYsMCwxLTAuNCwxLTFWMThDMTUsMTcuNCwxNC42LDE3LDE0LDE3eiIvPg0KCTxwYXRoIGQ9Ik0yOCwzSDE4Yy0wLjYsMC0xLDAuNC0xLDF2MTBjMCwwLjYsMC40LDEsMSwxaDEwYzAuNiwwLDEtMC40LDEtMVY0QzI5LDMuNCwyOC42LDMsMjgsM3oiLz4NCgk8cGF0aCBkPSJNMjgsMTdIMThjLTAuNiwwLTEsMC40LTEsMXYxMGMwLDAuNiwwLjQsMSwxLDFoMTBjMC42LDAsMS0wLjQsMS0xVjE4QzI5LDE3LjQsMjguNiwxNywyOCwxN3oiLz4NCjwvZz4NCjwvc3ZnPg0K", "name": "RoomBasedCameraMovement", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Glyphster Pack/Master/SVG/Applications and Programming/Applications and Programming_app_apps_applications_tiles.svg", "shortDescription": "Move/zoom camera to frame the room object containing the player.", "version": "1.0.5", "description": [ "Move camera to the room that contains the trigger object (usually the player). If desired, change zoom to show the entire room or keep zoom static.", "", "How to use:", "- Place room objects on scene", "- Select camera zoom limits, how fast the camera should move, and the visible buffer around each room", "- Run the \"Move and zoom camera\" action on every frame", "- Move the trigger object (player) between rooms and the camera will center on the room that contains the trigger object.", "", "Tips:", "- Use these conditions for custom logic when changing rooms : \"Camera moving\", \"Camera zooming\", and \"Room changed\"", "- Set \"Lerp Speed\" to \"1\" to change the camera instantly" ], "origin": { "identifier": "RoomBasedCameraMovement", "name": "gdevelop-extension-store" }, "tags": [ "camera", "follow", "room", "trigger", "zoom", "move", "smooth" ], "authorIds": [ "gqDaZjCfevOOxBYkK6zlhtZnXCg1", "8Ih1aa8f5gWUp4UB2BdhQ2iXWxJ3", "dt0tRnf2kHWJnjkrpnzTzNj9Yc63" ], "dependencies": [], "globalVariables": [], "sceneVariables": [], "eventsFunctions": [ { "description": "Move and zoom camera to the room object that contains the trigger object (usually the player).", "fullName": "Move and zoom camera to the room object that contains the trigger object (player)", "functionType": "Action", "group": "Layers and cameras", "name": "MoveCameraToActiveRoom", "sentence": "Move camera to room object _PARAM1_ that contains trigger object _PARAM2_ (Layer: _PARAM3_, Lerp speed: _PARAM4_, Max zoom: _PARAM5_, Min zoom: _PARAM6_, Border buffer: _PARAM7_px)", "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Initialize", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Save input values" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.MaxZoom", "=", "MaxZoom" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.LerpSpeed", "=", "LerpSpeed" ] } ] }, { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Set default values if none provided" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.MaxZoom", "<=", "0" ] } ], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.MaxZoom", "=", "1" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.LerpSpeed", "<=", "0" ] } ], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.LerpSpeed", "=", "0.1" ] } ] } ], "parameters": [] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Main", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Identify the current room", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Detect which room is the current one" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CollisionPoint" }, "parameters": [ "RoomObject", "TriggerObject.CenterX()", "TriggerObject.CenterY()" ] } ], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Room has NOT changed" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarObjet" }, "parameters": [ "TriggerObject", "__RoomBasedCameraMovement.CurrentRoomID", "=", "RoomObject.Variable(__RoomBasedCameraMovement.RoomID)" ] } ], "actions": [ { "type": { "value": "SetObjectVariableAsBoolean" }, "parameters": [ "TriggerObject", "__RoomBasedCameraMovement.RoomChanged", "False" ] } ] }, { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Room has changed" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarObjet" }, "parameters": [ "TriggerObject", "__RoomBasedCameraMovement.CurrentRoomID", "!=", "RoomObject.Variable(__RoomBasedCameraMovement.RoomID)" ] } ], "actions": [ { "type": { "value": "SetObjectVariableAsBoolean" }, "parameters": [ "TriggerObject", "__RoomBasedCameraMovement.RoomChanged", "True" ] } ] }, { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Update CurrentRoomID variable" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "TriggerObject", "__RoomBasedCameraMovement.CurrentRoomID", "=", "RoomObject.Variable(__RoomBasedCameraMovement.RoomID)" ] } ] } ] } ], "parameters": [] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Move camera", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::ForEach", "object": "RoomObject", "conditions": [], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Assign each room a unique ID if they don't have one yet" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarObjet" }, "parameters": [ "RoomObject", "__RoomBasedCameraMovement.RoomID", "=", "0" ] } ], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.MaxRoomID", "+", "1" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "RoomObject", "__RoomBasedCameraMovement.RoomID", "=", "Variable(__RoomBasedCameraMovement.MaxRoomID)" ] } ] }, { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Check if this room is the current room" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarObjet" }, "parameters": [ "RoomObject", "__RoomBasedCameraMovement.RoomID", "=", "TriggerObject.Variable(__RoomBasedCameraMovement.CurrentRoomID)" ] } ], "actions": [], "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Change zoom", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Calculate the camera dimensions" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.CameraWidth", "=", "RoomObject.Width()+2*OutsideBuffer" ] }, { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.CameraHeight", "=", "RoomObject.Height()+2*OutsideBuffer" ] }, { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.CameraZoom", "=", "min(SceneWindowHeight() / Variable(__RoomBasedCameraMovement.CameraHeight), SceneWindowWidth() / Variable(__RoomBasedCameraMovement.CameraWidth))" ] } ] }, { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Adjust zoom to stay within min/max values" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.CameraZoom", "=", "clamp(Variable(__RoomBasedCameraMovement.CameraZoom),MinZoom,Variable(__RoomBasedCameraMovement.MaxZoom))" ] } ] }, { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Change camera zoom" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ZoomCamera" }, "parameters": [ "", "ceil(lerp(CameraZoom(Layer,Camera),Variable(__RoomBasedCameraMovement.CameraZoom),Variable(__RoomBasedCameraMovement.LerpSpeed))*1000)/1000", "Layer", "Camera" ] } ] } ], "parameters": [] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Move camera position", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "For rooms smaller than the viewable screen, center the camera on the center of the room" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.CameraWidth", "<=", "SceneWindowWidth()" ] } ], "actions": [ { "type": { "value": "SetCameraCenterX" }, "parameters": [ "", "=", "ceil(lerp(CameraX(Layer,Camera), RoomObject.CenterX(), Variable(__RoomBasedCameraMovement.LerpSpeed))*100)/100", "Layer", "Camera" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.CameraHeight", "<=", "SceneWindowHeight()" ] } ], "actions": [ { "type": { "value": "SetCameraCenterY" }, "parameters": [ "", "=", "ceil(lerp(CameraY(Layer,Camera), RoomObject.CenterY(), Variable(__RoomBasedCameraMovement.LerpSpeed))*100)/100", "Layer", "Camera" ] } ] }, { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "For rooms larger than the viewable screen, center the camera on the TriggerObject and clamp camera so it only shows the room + buffer" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.CameraWidth", ">", "SceneWindowWidth()" ] } ], "actions": [ { "type": { "value": "SetCameraCenterX" }, "parameters": [ "", "=", "ceil(lerp(CameraX(Layer,Camera), clamp(TriggerObject.CenterX(), \nRoomObject.CenterX() - RoomObject.Width()/2 + SceneWindowWidth()/2 - OutsideBuffer, RoomObject.CenterX() + RoomObject.Width()/2 - SceneWindowWidth()/2 + OutsideBuffer), Variable(__RoomBasedCameraMovement.LerpSpeed))*100)/100", "Layer", "Camera" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.CameraHeight", ">", "SceneWindowHeight()" ] } ], "actions": [ { "type": { "value": "SetCameraCenterY" }, "parameters": [ "", "=", "ceil(lerp(CameraY(Layer,Camera), clamp(TriggerObject.CenterY(), \nRoomObject.CenterY() - RoomObject.Height()/2 + SceneWindowHeight()/2 - OutsideBuffer, RoomObject.CenterY() + RoomObject.Height()/2 - SceneWindowHeight()/2 + OutsideBuffer), Variable(__RoomBasedCameraMovement.LerpSpeed))*100)/100", "Layer", "Camera" ] } ] } ], "parameters": [] } ] } ] } ], "parameters": [] } ], "parameters": [] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Calculate \"IsCameraMoving\" condition", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Initialize", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.PrevCameraX", "=", "0" ] }, { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.PrevCameraY", "=", "0" ] } ], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.PrevCameraX", "=", "CameraX(Layer, Camera)" ] }, { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.PrevCameraY", "=", "CameraY(Layer, Camera)" ] } ] } ], "parameters": [] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Check if camera position changed", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Camera has NOT moved" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.PrevCameraX", "=", "CameraX(Layer,Camera)" ] }, { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.PrevCameraY", "=", "CameraY(Layer,Camera)" ] } ], "actions": [ { "type": { "value": "SetSceneVariableAsBoolean" }, "parameters": [ "__RoomBasedCameraMovement.CameraMoving", "False" ] } ] }, { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Camera has moved" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "BuiltinCommonInstructions::Or" }, "parameters": [], "subInstructions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.PrevCameraX", "!=", "CameraX(Layer,Camera)" ] }, { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.PrevCameraY", "!=", "CameraY(Layer,Camera)" ] } ] } ], "actions": [ { "type": { "value": "SetSceneVariableAsBoolean" }, "parameters": [ "__RoomBasedCameraMovement.CameraMoving", "True" ] } ], "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Update with current camera position" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.PrevCameraX", "=", "CameraX(Layer, Camera)" ] }, { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.PrevCameraY", "=", "CameraY(Layer, Camera)" ] } ] } ] } ], "parameters": [] } ], "parameters": [] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Calculate \"IsCameraZooming\" condition", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Initialize", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.PreviousZoom", "=", "0" ] } ], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.PreviousZoom", "=", "CameraZoom(Layer, Camera)" ] } ] } ], "parameters": [] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Check if camera zoom changed", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Camera zoom has NOT changed" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.PreviousZoom", "=", "CameraZoom(Layer,Camera)" ] } ], "actions": [ { "type": { "value": "SetSceneVariableAsBoolean" }, "parameters": [ "__RoomBasedCameraMovement.CameraZooming", "False" ] } ] }, { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Camera zoom has changed" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarScene" }, "parameters": [ "__RoomBasedCameraMovement.PreviousZoom", "!=", "CameraZoom(Layer,Camera)" ] } ], "actions": [ { "type": { "value": "SetSceneVariableAsBoolean" }, "parameters": [ "__RoomBasedCameraMovement.CameraZooming", "True" ] } ], "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Update with current camera zoom" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarScene" }, "parameters": [ "__RoomBasedCameraMovement.PreviousZoom", "=", "CameraZoom(Layer, Camera)" ] } ] } ] } ], "parameters": [] } ], "parameters": [] } ], "parameters": [ { "description": "Room object", "longDescription": "Room objects are used to mark areas that should be seen by the camera.", "name": "RoomObject", "type": "objectList" }, { "description": "Trigger object (player)", "longDescription": "When the Trigger Object touches a new Room Object, the camera will move to the new room", "name": "TriggerObject", "type": "objectList" }, { "description": "Layer", "name": "Layer", "type": "layer" }, { "description": "Lerp speed", "longDescription": "Range: 0 to 1", "name": "LerpSpeed", "type": "expression" }, { "description": "Maximum zoom", "name": "MaxZoom", "type": "expression" }, { "description": "Minimum zoom", "name": "MinZoom", "type": "expression" }, { "description": "Outside buffer (pixels)", "longDescription": "Minimum extra space displayed around each side the room", "name": "OutsideBuffer", "type": "expression" }, { "description": "Camera", "name": "Camera", "type": "expression" } ], "objectGroups": [] }, { "description": "Check if trigger object (usually the player) has entered a new room on this frame.", "fullName": "Check if trigger object (player) has entered a new room", "functionType": "Condition", "name": "ActiveRoomChanged", "sentence": "_PARAM1_ has just entered a new room", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "ObjectVariableAsBoolean" }, "parameters": [ "TriggerObject", "__RoomBasedCameraMovement.RoomChanged", "True" ] } ], "actions": [ { "type": { "value": "SetReturnBoolean" }, "parameters": [ "True" ] } ] } ], "parameters": [ { "description": "Trigger object (player)", "name": "TriggerObject", "type": "objectList" } ], "objectGroups": [] }, { "description": "Check if camera is zooming (requires the use of \"Move and zoom camera\" action in this extension).", "fullName": "Check if camera is zooming", "functionType": "Condition", "name": "IsCameraZooming", "sentence": "Camera is zooming", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "SceneVariableAsBoolean" }, "parameters": [ "__RoomBasedCameraMovement.CameraZooming", "True" ] } ], "actions": [ { "type": { "value": "SetReturnBoolean" }, "parameters": [ "True" ] } ] } ], "parameters": [], "objectGroups": [] }, { "description": "Check if camera is moving (requires the use of \"Move and zoom camera\" action in this extension).", "fullName": "Check if camera is moving", "functionType": "Condition", "name": "IsCameraMoving", "sentence": "Camera is moving", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "SceneVariableAsBoolean" }, "parameters": [ "__RoomBasedCameraMovement.CameraMoving", "True" ] } ], "actions": [ { "type": { "value": "SetReturnBoolean" }, "parameters": [ "True" ] } ] } ], "parameters": [], "objectGroups": [] } ], "eventsFunctionsFolderStructure": { "folderName": "__ROOT", "children": [ { "folderName": "Layers and cameras", "children": [ { "functionName": "MoveCameraToActiveRoom" } ] }, { "functionName": "ActiveRoomChanged" }, { "functionName": "IsCameraZooming" }, { "functionName": "IsCameraMoving" } ] }, "eventsBasedBehaviors": [], "eventsBasedObjects": [] }, { "author": "Silver-Streak, @Bouh, Tristan Rhodes", "category": "Game mechanic", "dimension": "2D", "extensionNamespace": "", "fullName": "Object \"Is On Screen\" Detection", "gdevelopVersion": "", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLW1vbml0b3Itc2NyZWVuc2hvdCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik05LDZINVYxMEg3VjhIOU0xOSwxMEgxN1YxMkgxNVYxNEgxOU0yMSwxNkgzVjRIMjFNMjEsMkgzQzEuODksMiAxLDIuODkgMSw0VjE2QTIsMiAwIDAsMCAzLDE4SDEwVjIwSDhWMjJIMTZWMjBIMTRWMThIMjFBMiwyIDAgMCwwIDIzLDE2VjRDMjMsMi44OSAyMi4xLDIgMjEsMiIgLz48L3N2Zz4=", "name": "IsOnScreen", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/monitor-screenshot.svg", "shortDescription": "Condition to check if an object is visible in its layer's camera viewport.", "version": "1.2.2", "description": [ "This extension adds conditions to check if an object is located within the visible portion of its layer's camera. The condition also allows for specifying padding to the virtual screen border.", "", "Note that this does not take into account any object visibility, such as being hidden or 0 opacity, but can be combined with those existing conditions." ], "origin": { "identifier": "IsOnScreen", "name": "gdevelop-extension-store" }, "tags": [ "is on screen", "condition", "visible", "hide", "screen" ], "authorIds": [ "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", "8Ih1aa8f5gWUp4UB2BdhQ2iXWxJ3", "gqDaZjCfevOOxBYkK6zlhtZnXCg1" ], "dependencies": [], "globalVariables": [], "sceneVariables": [], "eventsFunctions": [], "eventsFunctionsFolderStructure": { "folderName": "__ROOT" }, "eventsBasedBehaviors": [ { "description": "This behavior provides a condition to check if the object is located within the visible portion of its layer's camera. The condition also allows for specifying padding to the virtual screen border.\nNote that object visibility, such as being hidden or 0 opacity, is not considered (but you can use those existing conditions in addition to this behavior).", "fullName": "Is on screen", "helpPath": "", "iconUrl": "", "name": "InOnScreen", "objectType": "", "previewIconUrl": "", "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "description": "Checks if an object position is within the viewport of its layer.", "fullName": "Is on screen", "functionType": "Condition", "name": "IsOnScreen", "sentence": "_PARAM0_ is on screen (padded by _PARAM2_ pixels)", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "/*", "Get the object layer, convert the position from this layer to the screen coordinates.", "Get the point on each side on the object on screen, and compare with the screen area.", "", "This way even if the camera has a rotation or custom scale the object is always compared to the screen area.", "*/", "", "", "// Get the layer of the object.", "const object = objects[0];", "const layer = runtimeScene.getLayer(object.getLayer());", "", "// Get the aabb of the object on his layer.", "const aabb = object.getVisibilityAABB();", "", "// Get the layer to convert the coordinates of the AABB to the screen coordinates", "const topLeft = layer.convertInverseCoords(aabb.min[0], aabb.min[1]);", "const topRight = layer.convertInverseCoords(aabb.max[0], aabb.min[1]);", "const bottomRight = layer.convertInverseCoords(aabb.max[0], aabb.max[1]);", "const bottomLeft = layer.convertInverseCoords(aabb.min[0], aabb.max[1]);", "", "// Get the points on each side of the object on screen.", "const posLeftObjectOnScreen = Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);", "const posRightObjectOnScreen = Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);", "const posUpObjectOnScreen = Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);", "const posDownObjectOnScreen = Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);", "", "const padding = eventsFunctionContext.getArgument(\"Padding\");", "", "if (", " !(posLeftObjectOnScreen - padding > runtimeScene.getGame().getGameResolutionWidth() ||", " posUpObjectOnScreen - padding > runtimeScene.getGame().getGameResolutionHeight() ||", " posRightObjectOnScreen + padding < 0 ||", " posDownObjectOnScreen + padding < 0", " )", ") {", " eventsFunctionContext.returnValue = true;", "}", "" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "IsOnScreen::InOnScreen", "type": "behavior" }, { "description": "Padding (in pixels)", "longDescription": "Number of pixels to pad the screen border. Zero by default. A negative value goes inside the screen, a positive value go outside.", "name": "Padding", "type": "expression" } ], "objectGroups": [ { "name": "Group", "objects": [] } ] } ], "eventsFunctionsFolderStructure": { "folderName": "__ROOT", "children": [ { "functionName": "IsOnScreen" } ] }, "propertyDescriptors": [], "propertiesFolderStructure": { "folderName": "__ROOT" } } ], "eventsBasedObjects": [] } ], "externalLayouts": [] }