TwinBlazar's Recent Forum Activity

  • EDIT: You must use mouse.AbsoluteX and mouse.AbsoluteY !!

    Not sure how are you doing it behind the scene, but what I would do is to get the coordinate of the mouse on the minimap first.

    You will need this calculation:

    minimapXCoordinateInPercent = (mouse.x / minimap.Width) 
    minimapYCoordinateInPercent = (mouse.y / minimap.Height)[/code:3uhu9216]
    
    This will make it so you will get value between 0 to 1. With this, you can map it to the width and height of the real map:
    
    [code:3uhu9216]realCoordinateXOnMap = minimapXCoordinateInPercent * layoutWidth
    realCoordinateYOnMap = minimapYCoordinateInPercent * layoutHeight[/code:3uhu9216]
    
    As an example, let's say the minimap is a sprite and is 100 x 100 pixels and the hotspot is at (0,0) on the sprite. For simplicity reason, let's assume this minimap is also at (0,0) on a HUD layer.
    
    Now, suppose u clicked on this minimap, u will get the coordinate of the mouse. Suppose mouse.x and mouse.y are at (70,90), you can map this back to the size of the minimap. Assuming your map (or layout) is 2000 x 2000 pixels, we will do the following calculation:
    
    [code:3uhu9216]minimapXCoordinateInPercent = (70 / 100) 
    minimapYCoordinateInPercent = (90 / 100)[/code:3uhu9216]
    
    The calculation above will give you 70/100 = 0.7 and 90/100 = 0.9 respectively.
    
    [code:3uhu9216]realCoordinateXOnMap = 0.7 * 2000
    realCoordinateYOnMap = 0.9 * 2000[/code:3uhu9216]
    
    This will give you 0.7*2000 = 1400 and 0.9*2000 = 1800. (1400, 1800) is the position on the real map from the minimap. 
    
    This is the gist of what you have to do. There are other issues you will need to take care of such as what if the position of the minimap is not at (0,0) but movable to anywhere on HUD? Or what if the map has a different width and height? But before we dive into these, you should understand the above first.
  • I used to add images into different animation of a Sprite object. For example, I got 4 type of penguin enemy and each of them have their own idle animation and gotHit animation. So I got 8 animations in one Sprite.

    You can add in more images into a single Sprite object. But make sure, not to use too many images because you could hit the nasty 10,000 object limit.

    Alternatively, you could design your images as components. Ex. arms, legs, torso, etc. as separate images, assemble them up and animate them using something like https://www.scirra.com/store/game-makin ... ter-pro-78 This could reduce number of animation frames and allow compositional design.

    But again, this also depends on what kind of game are you making.

  • In that case, maybe you wanna try this? https://www.scirra.com/tutorials/756/se ... -waypoints

    And then manipulate these planets' positions based on the waypoints.

  • What browser are you using? Does it affect all browsers?

    I used to run into something similar when I save state the game on Firefox preview. The issue does not occur on Chrome and also does not occur on Firefox if I play the game exported as HTML5 site and uploaded to a server.

  • Why do you want to scroll back to where you keep them? You forgot their names?

    For me, if I have lots of global variables to be used and referred to, I will just use Snipping Tool to snapshot all those global variables, place the snapshot on the left side of the screen and place C2 on the right side.

  • I'll give you a little hint: First, just create one object, give it variable centerx = 300, centery = 300, radiusx = 100, radiusy = 30, angle = 0

    every tick for the object, do this:

    set angle = object.angle + 360*dt

    set x = object.centerx + object.radiusx*cos(object.angle)

    set y = object.centery + object.radiusy*sin(object.angle)

    Now, run it and you should see the object spinning around in oval manner centered at 300,300. Now, imagine for loop for many objects... does that ring any bell?

  • does fit your bill?

  • From the image, I am assuming you wanna the planets to be rotate around in circular like Rotary Dial telephone.

    One possibility is to use this math formula:

    x = centerx + radiusx*cos(angle)

    y = centery + radiusy*sin(angle)

    Read more: http://www.themathpage.com/atrig/unit-circle.htm

    Once you understand what these formulae do, you could extend it with for loop to loop through your planet and move these planets in circular motion.

    Do you follow?

  • I think the auto-complete is fine for this. Beside, if you organize all those variables well, you should not have any trouble.

    Can you provide a use case that might show the benefit of your suggestion?

  • How about you show us your capx or event sheet so we can investigate what went wrong?

    If you wanna post links, since you have less than 500 reputation, any of your posts with links will have the links removed. To remedy this, make it so your link doesn't look like a link. Ex. change "http://www.abx" to "tp:www.abx"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I assume you are pausing with timescale setting to 0 and set object timescale for player object to 1.

    In the event sheet, what you wanna do is to create a global variable "pause". When you pause, set "pause" to 1, and 0 when unpause. You will then add additional condition "if pause = 0" for all player's input. This is for normal game pause.

    Now, for when the player dies, create another global variable "deathpause". Set it to 1 when player dies. Adds this variable as another conditional check "deathpause = 0" to all appropriate places such as when the player sprite might change animation (This is all up to your game.). This is so the animation won't change if player is already dead. Also, dont forget to set "deathpause" back to 0 when the player respawns.

  • The above post is a naive implementation and it uses 2 TextBox objects. (TextBox1 and TextBox2) If you have 20 TextBoxes, having TextBox1, TextBox2 up to TextBox20 would work but it is ugly. You could go naive and create them like TextBox_Line3_Column1, Textbox_Line3_Column2 and Text_Line3. This works... but if you have to create 100 of lines, creating 100 lines manually would be hellish work.

    If your requirement is just that or if it is unlikely to change later, you can just go with the paragraph above.

    A more practical approach to iteration would be to have just 1 TextBox object, create many instances of them (copy and paste them) and refer to them using for loop and variables. The same goes with the Text object.

    So instead, for the 7 lines, what I would do is to create a variable for the textbox and text object. Let's call it "LineNumber". Once you arrange those TextBoxes and Texts on your layout to be in the correct order, you set LineNumber for each TextBox and Text instance accordingly to the line they are on. For example, line 1 instances have LineNumber set as 1, etc. For the textbox instances, you will also need another variable called "column". For the Textbox instances on column 1, give this value of 1. Do the same for Textbox instances on column 2 but give them value of 2.

    In the event sheet, you can do something like this:

    global variable sum = 0

    for i = 1 to 7,

    set sum = 0

    TextBox of variable Column 1 and LineNumber i: add int(TextBox.text) to sum.

    TextBox of variable Column 2 and LineNumber i: add int(TextBox.text) to sum.

    Text of LineNumber i : set text to global variable sum.

TwinBlazar's avatar

TwinBlazar

Member since 14 Apr, 2013

Twitter
TwinBlazar has 1 followers

Connect with TwinBlazar

Trophy Case

  • 11-Year Club

Progress

11/44
How to earn trophies