Bl4ckSh33p's Recent Forum Activity

    Hi! I am looking for somthing similar.

    I installed the System Time Plugin () and I want to show a custom countdown.

    The User has 3 input fields. One for Days, Hours and Minutes. So if you enter 1 Day, 12 Hours it should display a Countdown counting down the entered amount of time.

    But it should work even if you close the app for a while and reopen it a few hours later (thats why you need the plugin).

    So if you launch a timer you need to get the current system time (I used the unix format) and then add the entered Amount of time and store it. And every x Seconds (or whenever you want to refresh your countdown timer) it should show the remaining time. Did anyone already create something like this or know a good/easy way to do this?

  • This will be very useful for my new project. Thank you very much.

  • Hi. I tried to reproduce it in a new very simple project but it worked there.

    I tried to add "On Image URL Loaded" to my existing code but it did not work with the For-loop (and you cant put it inside/below the loop) so I created this workaround and just changed the sprite size depending on the first letter in the filename (1 for 100 pixel, 2 for 200 pixel) and it seems to work now.

  • But when I add a "On Image URL loaded" (triggers once after loading an image) event and set a variable containing Sprite.ImageHeight it returns 0. o.O

  • Thank you very much! I changed the animation image in the for-loop and set it to loopindex and it works.

    But I have some problems getting the image/sprite height after loading an image. It seems it is not updated properly after loading a image from URL.

    Did you ever use Sprite.Height or .ImageHeigt after loading an image?

    After many tries I were not able to get the proper values so I reported it (may be a bug):

  • Problem Description

    After loading an external image into a sprite with the option set to resize the sprite to image size you cant get Sprite.Height and Sprite.ImageHeight.

    When I output the Sprite.Height it always shows the default value of 177, but all loaded images have sizes of 100, 200 or more pixels.

    When I output the Sprite.ImageHeight it always shows 100 even if the loaded image has 200 or more pixels (can't find the reason for this).

    The images have this sizes: 1.jpg 100x100 pixel, 2.jpg 100x100 pixel, 3.jpg 100x200 pixel, 4.jpg was a huge screenshot to see if size changes.

    The animated sprites seem to resize properly, the screenshot was not streched but Sprite.Height returns 177 (the default value of the TempSprite object placed outside of the layout).

    Attach a Capx

    Attached

    Description of Capx

    It loads a banner.txt file containing a list of filenames like 1.jpg|2.jpg|3.jpg... and then creates a loop to create a new sprite for each image.

    To be able to position them depending on their height I used a second sprite object (TempSprite) to load the image first and then use Sprite.Height / Sprite.ImageHeight in the Create Sprite action. All Sprites should move from top to bottom with 10px space between them and wrap around at the end (wrap behavior does not seem to work properly if youc reate sprites outside of the layout so I used my own code with position check)

    I installed XAMPP (local Apache Server) to test it on localhost. Don't know how to change it so you can reproduce it easily.

    relevant code starts in line 19

    Observed Result

    Sprite.Height and Sprite.ImageHeigt of the TempSprite object is always the same value even if the loaded images have different sizes.

    Expected Result

    Since "Resize to Image Size" is set in the Load from URL action it should change the sprite size and the new size should be returned.

    Affected Browsers

    • Chrome: YES
    • FireFox: Don't know
    • Internet Explorer: YES

    Operating System and Service Pack

    Windows 8.1 64 Bit

    Construct 2 Version ID

    r166

  • Seems I found it in the closed bugs section:

    But is it possible to add new frames on runtime and load a different image for all frames for a sprite object and then set the shown frame for each object?

    I cant test it right now because I don't have access to C2 here.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi. Seems I encountered the same problem here:

    So a for-loop picking separate instances of a sprite will not work and even if you pick a single instance all sprites will load the new image, right?

    I tried to load external images for all sprites so the user can customize it.

    Is it possible to add new frames on runtime and load a different image for all frames for a sprite object and then set the shown frame for each object?

  • I am not sure, but it could be a bug since all other actions I tried seem to work different and "pick" the last created object as target.

    It would be much easier (for my needs in this project) if it would just work like the other actions and change the image of the last created sprite. Did anyone else have problems with this?

    Maybe I can add an Instance Variable with the image url/filename and create another "for x=1, numSprites" loop and then change the image of the sprites? I will test this when I have more time this evening. But I am not very experienced with picking objects, yet.

  • It looks like this:

    Something Happens > Create Sprite on Layer0 at x,y

    ---------------------------- Set Bullet Angle of Motion to 90

    ---------------------------- Load image from URL: URL here

    Setting instance variables or changing behaviors like the bullet seems to work fine directly after creating an object to apply the changes to this object. But the Load Image from URL action seems to apply it to all instances of the object. (Sprite)

    I will take a look at your link, thanks.

  • Hi! I used Create Object for Sprites a few times in other projects and it seemed to work fine if you add some actions right after the create action to set instance variables or options.

    But if I add "Load Image from URL" all created sprites have the same image. Do I have to add Instance Variables for the UID and add a loop for all instances (pick all) to change their image? Or is there another/easier way to do this?

  • I installed XAMPP and used localhost/bla/image.jpg and it seems to work fine. It would be nice to be able to get a list of all files in a folder with AJAX functions but I think it will work if I add a .txt file with all files in it.

    But I get a security error popup in the browser object in my app (sometimes line 2422 in c2runtime.js) but it seems to work fine.

Bl4ckSh33p's avatar

Bl4ckSh33p

Early Adopter

Member since 20 Jul, 2013

Twitter
Bl4ckSh33p has 5 followers

Connect with Bl4ckSh33p

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • x3
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x7
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x2
    Lightning Draw First person to up-vote a new Construct 3 release
  • x4
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

21/44
How to earn trophies