theubie's Forum Posts

  • My wording was a little off in my post, the capx has it correct.

    You actually subtract the two X and two Y velocities.

    So, given:

    Object 1: Vx=10, Vy=0

    Object 2: Vx=11, Vy=1

    You would get:

    abs((10-11) + (0-1))

    abs(-1+-1)

    abs(-2)

    Relative Velocity of 2

    Sorry about the confusion in the post itself. It's really late/early here.

  • I am going to have to do a tutorial over this. Seen it pop up a couple of times recently. I had this exact question a while ago:

    Here is a demo of rocks smashing into each other in space using the momentum forumla to figure out relative damage based on velocity and mass: Demo

    And here's the capx (r120.2). Basically, you want to add each object's x velocity and y velocities together, then add those two results together to get a relative velocity. Since that velocity can be negative, you take the abs of that relative velocity and use it with the mass of the object to get your momentum. After that, you decide how much damage each unit of momentum is worth and wreak havoc.

  • Make a sub event under event 35:

    System -> Compare Values BulletType >= 1

    -- (Spawn your other two rockets)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm. FWIW, here's a screenshot of my fix, which worked on both Kong and here on Scirra's Arcade:

    <img src="http://www.infinitepossibilitygames.com/demos/focus/focusfix.png" border="0" />

    If that doesn't fix it, not sure what else might be causing it. I would be willing to look at a capx if you want.

  • Use the expression: angle(Player.X,Player.Y,Bullet.X,Bullet.Y) (replace Player and Bullet with the two sprites)

  • Suro

    Make an on any click event, use the browser focus action. It fixed my focus problem with Kongregate...probably will fix yours on Newgrounds as well.

  • What ramones said. Didn't look close enough to the location of your quotation marks.

  • will108

    If you're usin $_GET on the php side, you want to use the AJAX request URL rather than the Post URL.

    To answer your initial question, yes your actual URL looks good.

  • If you have the tile numbers in an array you can push the first element to the back, then pop the first element.

    [1,2,3,4,5] - Starting array

    [1,2,3,4,5,1] - Push first element to the back

    [2,3,4,5,1] - pop the first element from the front

    Push the last element to the front and pop the last element to go the other way.

  • cjuliao

    For sending email, you've got two options.

    If you are running on your own server and have access to php or any other scripting language that has the ability to format and send emails, that is the best way to go. You put all the user info (name, email, person being sent to, their email, etc...) in an ajax call to your server which then will format and send the email. This allows you complete control over what you're sending and doesn't rely on the user having an email client that is configured and working correctly. If you have this option available to you at all, use it.

    If you don't have the above option, you can still pull this off if the circumstances are right. You can use the browser object's "go to url" to go to a "mailto:" string. If the user has a mail client that is configured correctly, it will open it up and start a new email. You can pass all normal email options via a mailto: cc, bcc, subject, body...etc. So you could in theory format a mail message based on text boxes in your game and throw it out there hoping they have a mail client that knows how to hand it. For more info on this, do a google search for "mailto:".

    As for returning...you can use the browser object to get the query and hash from the URL that called the game, so if you sent them the link yourgame.com/index.html you could use the query string to get the name=john%20doe part and parse that into John Doe for use in your game. Or if you wanted to use the hash tag you could use yourgame.com/index.html which would give you the string "brian" for the hash. Either way is a viable way to customize your game based on the URL that called it.

    tl;dr: The browser is your friend.

  • Containers are your friends.

    Put the health bar in a container with the enemy. When an enemy is spawned it will have it's own health bar spawned with it, and any time you pick that enemy it will automatically pick it's health bar.

    Just do a for each and loop through your enemies. Each time it picks an enemy, it will also pick that enemy's health bar so that you're only updating just that one.

    Here is a capx (R120.2) that demonstrates what I am talking about.

  • Do you want it to be a linear (i.e. every 100 points), exponential (i.e 100, 200, 400, 800 points, etc...) increase between power ups or do you want to use a list of values that you personally are picking arbitrary?

    The Mod operator is your friend here...That's the '%' symbol.

    Linear:

    System -> Compare Variable Score > 0

    System -> Compare Variable Score % 100 = 0

    -- System -> Trigger Once While True

    -- (Spawn your power up)

    Exponential is a little more tricky:

    Global Variable -> PowerUp = 1

    System -> Compare Value Score > 0

    System -> Compare Value Score %(PowerUp*100) = 0

    -- System -> Trigger Once While True

    -- System Add to PowerUp 1

    -- (Spawn your power up)

    And picking from a list is even more tricky if you aren't use to arrays.. You'll need an array object (we'll call it PowerUpArray):

    System -> On Layout Start

    --PowerUpArray Push Back 100 on X axis

    --PowerUpArray Push Back 300 on X axis

    --PowerUpArray Push Back 900 on X axis

    --(Repeat until all are in the array

    PowerUpArray -> Contains Score

    -- System -> Trigger Once While True

    -- (Spawn your power up)

  • You already have the right event in place, as long as it's a top level event and not a sub event.

    System -> For Each "Joint"

    Joint -> Is Overlapping "Web" (inverted)

    When that one is run, it will pick all joints that aren't overlapping a web. This will pick no joints unless a web has been destroyed, in which case on the next tick after a web is destroyed the joints that were overlapping it will now no longer be overlapping.

    Here's a capx (R120.2) with just the clean up code in action.

    The use of every tick only applies to running actions every tick. An event that is a top level event does it's check every tick, but if it doesn't evaluate to true then no actions are run. Speed wise, you're not going to take a hit evaluating your event over checking a single variable unless the event is a very complex one.

  • Not sure why you would even need a flag.

    System Compare Web.count <= 0 should be enough to figure out if your clean up needs to run for all joints. If that is true, then run your clean up code. Yes, it check ever tick, true, but your other events will only fire one time and will then be false until you spawn other webs.

    And the others will continue to be false unless a web was destroyed in the previous tick...then will be false again on the next tick.

    Same amount to checks as with a flag without the variable, which IMO is a better practice. Less is more.

  • datomsk669

    My first reaction would be to make it move directly away from the Chaser:

    angle(Chaser.X, Chaser.Y, Chased.X, Chased.Y) + 180 (or -180, both lead to the same angle)