Delphawi's Recent Forum Activity

  • Hello,

    I cannot get C3's AdMob to work, despite uploading the app to Google Play and linking it with AdMob.

    C3 keeps saying "Invalid server response" and that it cannot read publisher's data.

    I have copied the Android/iOS codes from AdMob and pasted them in C3 AdMob properties.

    What else should I check, please?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The Keyboard's IsDown event will always trigger while the key is pressed. Maybe you can try Keyboard OnKeyPressed instead; which triggers only once when the key is pressed.

  • OK, I managed to get the AJAX plugin to work!

    The solution was to remove ALL "Set Request Header" actions, even for "Content-Type".

    Now using PostToURL action (with Method="GET"), or RequestURL action (and passing parameters in the url), Work!

    What I don't understand is, why did the headers cause the issue??

    Even after allowing the Content-Type header on the server, setting Content-Type header using AJAX plugin always causes the CORS issue again.

    Header set Access-Control-Allow-Headers "Content-Type"

    Thank you!

  • So I have used scripts. AJAX plugin is still not working, but the script works!

    The script dynamically loads ajax script from cdn at the start, and when the CallAPI function is called, it uses the ajax object to call the api.

    Here is the full code:

    const dependenciesURL = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js";
    
    // Load a script and append it to the document
    const LoadScript = (scriptUrl) =>
    {
    	return new Promise((resolve) =>
    	{
    		const script = document.createElement("script");
    		
    		script.addEventListener("load", () => resolve(true));
    		script.addEventListener("error", () => resolve(false));
    
    		script.src = scriptUrl;
    
    		document.body.appendChild(script);
    	});
    }
    
    // Load all project dependencies
    async function LoadDependencies()
    {
    	const sdkAvailable = await LoadScript(dependenciesURL);
    
    	if (sdkAvailable)
    	{
    		console.log("Dependencies ready");
    		
    		InitializeDependencies();
    	}
    	else
    	{
    		console.log("Dependencies not available");
    	}
    }
    
    // Initialize variables
    function InitializeDependencies() {
    	console.log("InitializeDependencies");
    }
    
    // Call the loading functions
    LoadDependencies();
    
    function CallAPI(_type, _url, _data){
    	$.ajax({
    		 type: _type, // GET
    		 url: _url,
    		 data: _data,
    		 
    		 cache: false,
    		 
    		 success: function(response) {
    		 	console.log(response);
    		 }
    	});
    }
    

    So the api works using the browser, postman, and javascript, but not the AJAX plugin. Any idea what is going on here?

    Thank you!

  • Hello

    I have made a simple api. I can call it using url in the browser, and I can use Postman to call it. No authentication required.

    The server is allowed to accept any origin:

    Header set Access-Control-Allow-Origin "*"

    Yet, C3 AJAX keeps telling me:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at [...]. (Reason: CORS preflight response did not succeed). Status code: 422.

    Please help !

    Thank you :)

    Tagged:

  • Resize (Alt R)

    Change the size then edit the properties of Tilemap to the Tile Width and height you want

    Here is a quick video:

    https://youtu.be/ONq2oUUvQCg

    Thanks a lot. I think my question was not worded properly. I meant that I wanted to use the high-res version of the map without resizing.

    Similar to how we can use 1000*1000 sprite on a 10*10 instance.

  • Hello,

    I am making a game where the player re-arranges pieces of an image. I am using a tilemap for the image.

    I have a high-resolution tile map (1800*1800), and I want to use it in an instance that is 600*600. When using a sprite we can use a 1000*1000 sprite in the animation editor, and resize the instances as we like.

    Is it possible to do that with tilemaps? i.e. use high-resolution source image, but resize instances differently.

    Is there a way to do this?

    Thank you.

    Tagged:

  • Hello,

    I have AdSense script I want to add to the game's DOM on start of layout. I used javascript script to do that.

    It works in preview and the code shows when I view source, but no ads show up.

    When the game is uploaded to the server, I get this text in the source instead of the script that was correctly shown in preview:

    <noscript>
    		<div id="notSupportedWrap">
    			<h2 id="notSupportedTitle">This content requires JavaScript</h2>
    			<p class="notSupportedMessage">JavaScript appears to be disabled. Please enable it to view this content.</p>
    		</div>
    	</noscript>

    I checked browser settings, and JavaScript is enabled all right.

    Any idea if this is a server issue or C3 issue, or maybe it is caused by the ad itself?

    Thank you!

  • I usually try to differentiate objects using layers or instance variables, so when a click happens, I pick only the object that has specific conditions met.

  • I don't see a need to use JSON, you could append all variables into a string and then run through it again with tokenat to set the values on another instance. Saving to a temporary or local variable to swap them is fine though.

    That's somehow what I did.

    But it took more time than needed. I hoped AsJSON could do the job in one line.

  • Is the initial instance created at runtime?

    No, both instances are created during edit time.

    Then at runtime, the player changes the instances' states and variables.

    At one point, I need to swap the states of 2 instances.

    I tried to use:

    state1 = instance1.AsJSON

    state2 = instance2.AsJSON

    instance1 -> Set From JSON (state2)

    instance2 -> Set From JSON (state1)

    But it didn't work.

    I had to set the state manually (i.e. save each instance variable to a temporary variable, then swap them, and so on...).

    My question is: is there a way to use Set From JSON to set ALL the instance variables (i.e. state, in general) at once, instead of 1 by 1?

  • If you want to make a copy of an object you can right click on it and use 'clone'

    Thank you.

    What I want is to make a copy of an instance of an object at run time, instead of cloning an object at edit time.

Delphawi's avatar

Delphawi

Member since 3 Dec, 2013

Twitter
Delphawi has 1 followers

Trophy Case

  • 11-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x2
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x2
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

18/44
How to earn trophies