BENTOTILESSDK DOCS
Game Engines

Godot 4 Integration

Learn how to connect your Godot 4 Web export to BentoTiles using JavaScriptBridge.

Godot 4 Setup Guide

Integrate the BentoTiles SDK into your Godot 4 HTML5 Web export using JavaScriptBridge.


GDScript Implementation (bentotiles_sdk.gd)

Create a script attached to an Autoload node in Godot:

extends Node
class_name BentoTilesSDK

signal ad_started
signal ad_finished

func _ready():
	if OS.get_name() == "Web":
		var window = JavaScriptBridge.get_interface("window")
		if window and window.BentoTiles:
			var opts = JavaScriptBridge.create_object("Object")
			opts.gameId = "my-godot-game"
			window.BentoTiles.init(opts)

func commercial_break():
	if OS.get_name() == "Web":
		var window = JavaScriptBridge.get_interface("window")
		if window and window.BentoTiles:
			var opts = JavaScriptBridge.create_object("Object")
			opts.beforeAd = JavaScriptBridge.create_callback(_on_before_ad)
			opts.afterAd = JavaScriptBridge.create_callback(_on_after_ad)
			window.BentoTiles.commercialBreak(opts)

func _on_before_ad(_args):
	get_tree().paused = true

func _on_after_ad(_args):
	get_tree().paused = false