TwinBlazar's Forum Posts

  • In the case that all of these objects that could be drag around and all other objects you are testing for nearest distance are the same object type, I suggest you to create an invisible sprite on the object you are dragging, and refer to the code above using the invisible sprite in place of ObjectBeingDragged. This is because all those object picking is quite problematic when you have to refer to an object to another object that has the same object type.

    If you are doing the paragraph above, one of the thing you must also take care of is to eliminate the first nearest instance as you are creating the invisible sprite on the instance you wanna test on, and the first nearest instance actually has become the object you are testing for. Because of this, it must be excluded. So now, to look for 1st and 2nd nearest instances, you must now look for 2nd and 3rd nearest instance in the event sheet.

  • Picking n nearest instances? You may wish to mix "For Each (Ordered)" with distance formula:

     For Each EnemyObject order by distance(ObjectBeingDragged.X, ObjectBeingDragged.Y, EnemyObject.X, EnemyObject.Y) ascending [/code:ozycgyqb]
    
    This will iterate to all of your EnemyObject instances starting from EnemyObject nearest to ObjectBeingDragged in the first iteration, then the second nearest in the second iteration and so forth.
    
    Since you only need 2 nearest objects, you could go for something like:
    
    [code:ozycgyqb] 
    
    set global variable i = 1
    For Each EnemyObject order by distance(ObjectBeingDragged.X, ObjectBeingDragged.Y, EnemyObject.X, EnemyObject.Y) ascending 
    
    

    if i = 1:

    > set global variable uid1 = EnemyObject.UID

    if i = 2:

    > set global variable uid2 = EnemyObject.UID

    > stop loop

    add 1 to global variable i

    [/code:ozycgyqb]

  • You are new to this? Have you seen https://www.scirra.com/tutorials/37/beg ... onstruct-2 This is the basic foundation of C2 that you must understand before attempting to make anything else.

    [quote:1nj9zaac]but now the coin sometimes doesn't show on the layout.

    EDIT: just saw your edit. Can you check for the location of the coins? See Debug Preview and check where are the coins. (...or are there no coins?)

  • [quote:i1mreoa6]Enable the touching if the button is opaque (Opacity = 100) - If Button is touched and Button.Opacity = 100 then Do Something...

    It's not a good practice, but yes, that... also works, but don't forget that the button is now relying on Opacity to function properly. If in the future, you somehow have to adjust opacity for whatever reason outside of this scope, you better take care of changes with respect to buttons relying on opacity to work.

  • You could create another coin instance at location (random(LayoutWidth), random(LayoutHeight)) when the player collides with a coin. Presumely, this should be after when you would do the action destroy coin in the collision event.

    But the random coordinate above will sometimes create the coin at undesirable locations such as at the edge of the layout. This could make the coin appearing only partially on the layout. If you don't like this, you will want to add the size of the coin into account, so:

    Assuming the hotspot of the coin is at the center,

    coinWidth/2 + random(LayoutWidth - coinWidth),

    coinHeight/2 + random(LayoutHeight - coinHeight)

  • [quote:x9yn9s4h] i noticed that the background blurs and since the game is playing near 60 fps this shouldn't happen, also when if i turn off the camera and i just move my guy around he does get kind of blurry because of the speed.

    I could think of several possibilities.

    Could you try run your game on other monitor screens? Some of the old monitors render things in such a way that gives you a constant motion blur. Hardware Mouse motion blur, anyone?

    OR... this is just biological - an illusion your eyes are perceiving because of the objects are moving at high speed. Since you mentioned the background got blurred when you run at high speed, but the player will be blurred if the camera is turned off, along with mentioning everything blurs in Sonic at high speed but you didn't anything about blurring in SMB, I think this is likely to be the case.

    The reason that the background is blurry in both Sonic and your C2 game is because your character is moving so fast (while being centered) that the background goes through from side to side quickly and your eyes couldn't keep up with those quick visual changes. When you disabled your camera, only the character is blurred, because the character is now the one moving quickly on the screen.

    The games (Sonic and any C2 games) do not render anything blurry here but because those frames are being rendered at 60 fps and have visual updates moving so fast on the screen that your eyes are playing tricks with you.

    Is what am I thinking correct?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • come out of the camera......? Please elaborate further.

  • But yes, destroying all the unneeded buttons work too.

  • For this, you could use a variable on the buttons. Let's call it "allowTouch".

    In your touch event that checks for which button you are pressing on, you will also check for this variable "allowTouch". If "allowTouch" is 1, you will do everything you desires. If not, don't do anything.

    For collision enabling, that is for object collision check, not touch control check. So what you have been doing doesn't have any affect on touch control.

  • Congrats! That looks cool!

  • Create your own mouse Sprite object and make it so both mouse events and joystick events control this particular object. And hide the real mouse on the game screen.

  • No. But you could try asking for help on the Job Offer and Team Request forums. But do so at your own risk and don't forget to read the first pinned post!

  • In my game, I simply used the built in save game feature. All the configs (whether you use Dictionary or store config in variables) are saved along with the save game.

    However, if you want more controls, you can use LocalStorage. (see https://www.scirra.com/tutorials/1461/h ... age-plugin and https://www.scirra.com/manual/188/local-storage for more info) You could store each user option as a key-value pair in the local storage and retrieve these back later.

  • For AI in this case, you just have to "fake" the visual. I'm on mobile so I don't know how do you do your event sheets. But what I would do is separate the events into 2 parts. One would take in the player's input and the other would be automated events to give the player an impression of AI.

    You could try copy and paste all the player's events but change all player's input to be, for example, some other variables instead. Then, make it so when it is the AI's turn, you update these variables with respect to your game's rule and give an impression of AI to the player.

    This is the gist of what you have to do, but I couldn't say much on the technical implementation. This all depends on your event sheet design.

  • What you want isn't that simple, you see. I have suggested you the basics that you should try tackle first. Split the problem into smaller ones. See my previous post.

    Or... if anyone is reading this and got some free time, could you please give this gentleman here a hand?