JeremyBenson11's Forum Posts

  • I'm not sure I can help. Really need to see what's going on... too bad you couldn't post images yet, but you need certain reps to do that..

    Maybe if you explained it in clearer English.

    You have a player instantiated, and another object of the same type, just copy and pasted? And you have a circle that comes up around your player, and you want to test which enemies are in the circle? Find one enemy that's inside the circle?

    Attach an instance variables to your enemies. A Boolean set to false, called isInsidePlayerSight. Then add an event, every tick. Then add another condition, click the type your testing to overlap, and choose is overlapping another object, or oncollision with another object.. Click the circle.. then in the event click the object, set boolean value, turn isInsidePlayerSight to true... Then make a new event foreach of enemy. On the same event add a new condition choose enemy object, then find "is boolean instance variable set".. in that event do what you need to do to each enemy inside that circle.

  • This is something that was shared with me here.

    newX = enemyUnit.X + cos(random(360)) * random(100)

    newY enemyUnit.Y + sin(random(360)) * random(100)

    Say your enemy was picking a random point within a 100px radius from itself to move to. This is how you would do that... so maybe..

    newX = playerUnit.X + cos(random(360)) * random(100)

    newY playerUnit.Y + sin(random(360)) * random(100)

    would pick a random point up to this many px from the player..... You might have to play with the numbers though. This could put the enemy 1px away or 100px... you would adjust your range like random(50, 100).. Then they would pick a random point from 50 to 100 px away..

    You'll have to use another method if you want these points to be specific... not sure about that kind of math. Also you would have to implement a feature if you wanted the enemies to pick random points around the player that weren't the same... like test all previous checks in a while loop and pick a new location until they aren't the same..

    Not sure if this is a better way or not... One thing I do know. If you want your points to be picked cinematically this will not work.

  • Hm, to find a specific UID you use the event in the cog, for each. Select the object types to loop through, and you'll loop through each of that type. Then a sub event from that event, using the cog again, but this time choose compare two values. For the first value do sprite.UID then your comparison greater than, less than, and then your target value.. In that sub event destroy the sprite...

    Compare two values is very useful. You can use it for accessing dictionary keys with a specific value... Checking distance... all kinds of stuff.

  • As a side note your first comment said that you had the issue only when you added admob? If this is truly the case, and you have made sure everything is optimized properly: use tile image for images that aren't sprites, use right compression for images, use the right sizes for the right case, use animations only where necessary.. Then I would say your issue is just with admob..

    This is a related post with the same issue.

    If I were you I would contact Ashley (Support here), and possibly whoever made the plugin, the thread above says Google.

    If you can't fix the bug you may have to settle on a game without adbomb.

    Not sure why someone would put ads in a game though. Imagine playing Zelda link to the past on snes, and having a banner ad ..

    There are other monetization options for a site too: Adsense... Also, you can always sell your own adspace online. If you had 100,000 players on your site sell you adspace for $500-1000, or whatever the going rate is. You'll make 10X more money, and your game wont have an ad on it... players will thank you for it too

  • Cool, thanks for the Magistross

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Check this out for your image compression: https://www.scirra.com/tutorials/1154/d ... h-pngquant

    Just wondering. You have a player that moves right? By keys, or buttons? That's where you want to use dt. If you don't your game will run different on different speed computers. That's what dt is for to set things to a second timer, rather than frame rate alone, which is run by cpu power.

  • Hm, I don't think I'd be able to help. I'm not a guru by far, and have my own questions really. What did you use for you images? For things like backgrounds and stuff you're not supposed to use sprites. There's tiled background and tiled map. Using too many objects can slow your game down.

    The reason being is sprites have member data and functions attached to them. If you use these for something that's not going to use the functionality it's a waste of memory.

    Have you heard of classes in programming languages?

    well a sprite might store: image, position, angle, rotation, yad yad yad yad.. Then functions to rotate it, and everything else..

    Where as an image object might just store a rectangle, texture, and vector for location.

  • I don't understand your rant, this is something easily done in Construct.

    For each key in Dictionary

    +Compare two values : Dictionary.CurrentKey == "something"

    -->Do something with the value at this key

    I get ya. Right easy. Sorry. The thing is I'm not used to these events, and what they mean yet. Honestly, this would have been easier if this was located in the dictionary... like event from dictionary for each key, sub event from dictionary compare current key value... That would have made navigating it easier

    Thanks again.

  • Why is there no easy way to say in a for-each loop

    if key == "" do this to value?

    That seems like such a basic, but necessary bit to have. This would be done in 8 lines of php and an associative array. I'm trying not to hate Construct, but it's hard. Such simple things should not be so hard to figure out, or left out. They're important.

    Why would you want to loop through something only to do something with EVERY key, when almost EVERYONE, is going to want to do something with specific keys?

    can someone help me with this?

  • "can you send me the link to the forum page this is from. Only because I cant understand some of it since it is out of context."

    Just to warn you it's an old post about an unhappy customer with the same kind of problem. Lag... BUT the users swear it's because of the persons own doing, and great things are made in construct... so likely he could have improved his code/image performance by following proper procedures.

    good-scam_t82598?start=20

    "3: For the whole project: use Powers of two in the sprites?........what does it mean by that? 2,4,8,16? I'm confused:

    • Yes. Check out this article for more information. Sprites should be in boxes that are to the power of 2,

    http://www.katsbits.com/tutorials/textu ... of-two.php

    same with tiles and backgrounds. This article should help a lot with that.

    https://www.scirra.com/blog/112/remembe ... our-memory

    "7: Don't play animations too often......all my enemies are an animation that are spawned every 1.3-1.8 seconds. could this be the issue?"

    I'm not sure about the depth of Construct and its capabilities. This would be a question best suited for another member. I would say to watch where you're spawning enemies though. If they don't need to be on the screen, maybe they shouldn't exist (that is if you spawn them off screen). Like spawn enemies a few px off screen before the player gets to them (to make sure your not spawning baddies the player can't see), destroy anything that falls through the floor or off screen... if you're using gravity only use it on objects that need it and are in player view. (except in important cases)

    On code:

    "6.- Use delta time, you have lots of actions using time. That will help on frameratesss.....when would i be using this?"

    • Use delta time any time that you lerp, or move something.

    Say you have an even press right key. and that event does player.X + 12 every tick. What you really want is player.X + 12 * dt. This will make your game framework independent. Without delta time your movements are set to frame, thus effected by processor speed. dt

    Here's some knowledge for you on DT

    https://www.scirra.com/tutorials/67/del ... dependence

    7.- Also, use Groups, your code needs it, a lot.......what does this mean?

    • I can't really help with families and groups, I'm still learning this. One thing I can warn you is that if you don't know how families work you'll get some bad behavior, so don't implement these unless you need them, and you know what they do. Backup your project and have a good copy before you make any major edits...

    Sorry, I couldn't give more information, but if you read those articles it'll make your game better <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • I'm not sure about admob, but you can go through this list and see if any of it helps. It's something I borrowed from a thread to help me with my projects. It's pretty much a check list to help with efficiency. Just salvage what you can from it. I know the post was to someone else, but there might be something useful. Also someone else might be able to help better with your specific questions.

    1.- for the red character: Use a container for the eyes

    2.- for the red character: For the jump use image points or use EaseTween.

    3.- For the whole project: use Powers of two in the sprites.

    4.- Use PNG8 for the background

    6. - Keep pixel rounding on.

    7.- Don't play animations too often.

    8. - Remove collision from backgroun images, and uncollidable objects.

    9. - Pre-plan as much code as possible and use function object to cut back on events.

    On code:

    6.- Use delta time, you have lots of actions using time. That will help on frameratesss.

    7.- Also, use Groups, your code needs it, a lot.

    8.- And Functions, they can pass variables and data.

    9.- And Families, you are using lots of single events for destroying any block. Example on how to fix this: Assign instance variable ID "destroyOnClick" to anything that you want to be destroyed on click, and create a Group for that.

    10.- Why use WebGL if iOS doesn't support it?

    11.- The code is ALL the time checking and updating the End Screen (just remove the forest background to see what I mean).

    12.- Hide the End Screen btw., and only show it or create it when the red thing is over the Goal block.

  • Well, I figured that out. lastMouse positions minus current, if not zero moving... but that's still sketchy. There must be a good way to set scroll to a sprite that follows the mouse, and make it not scroll the screen like lightning.. All this will help my current project.

    Not all is lost, I have backup methods for everything, but the fall back is to set a scrolling item to last clicked unit, and make the map dragable. I would like to have both a slow scrolling mouse, and a dragable map lol

  • I see, thanks for the info. I'm not sure how low the numbers are going now, but they must be quite small. Able to get the sprites to be tiny in the top left corner. This is working now, but the newest issue is the mouse pointer. No matter what events I set up it doesn't seem to work.. The closest thing to what I wanted fro slow scrolling was

    set mouse style to none.

    every tick set sprite to point at Mouse.X,Mouse.Y and move the sprite forward 2px.

    Also the spirte for the pointer is set to scroll to.

    This lets me move the mouse around the map scrolling slow, but sometimes when the mouse is still the pointer spite I have flips out. It has something to do with the angle, and continually moving forward. Is there a way to capture if the mouse is moving? This might be a method of stopping it from flipping out.

    Something like

    If mouse is still set pointer sprite to Mouse.X, Mouse.Y...

  • Ugh, Now I'm having trouble with scroll to, and the mouse in general. Setting the cursor from sprite does not work, in any browser, or if I export the game for window.

    Start of layout - set mouse style to none.

    Every tick - set cursor from sprite.

    does nothing. The only thing that worked is.

    Everytick set cursor style - none

    every tick set position of cursorSprite to MouseX, Mouse,Y.

    The problem is when the cursor is used to scroll the screen it scrolls really, really fast.

    If I try to delay the speed by doing this.

    every tick - set angle of cursorSprite to Mouse.X, Mouse.Y and cursorSprite move forward 2px

    I get the slow scrolling I want, but sometimes the sprite image flips out and spins, which is no good.

    Construct is very buggy when it comes to the mouse. I already know it doesn't work in EI.. but you might as well add Chrome, and Firefox to the list, because they aren't working there either, or in desktop export...

    Why?

    Also wondering, is there a way to set the scroll speed, mouse speed, anything?

    I could handle the first working method, set sprite to mouse position, but can't handle the speed the screen scrolls when using the mouse to scroll...

    This is horrid experience for paying customer