AllanR's Forum Posts

  • ankas

    I haven't looked at Pulstar's example, but couldn't you use "Line of sight" to test if there are obstacles in the way or not? If there is no line of sight, then it is a miss, if there is line of sight, then use Pulstar's method...

    Also, Construct 3 adds a "step" feature that allows fast moving bullets to detect solids.

  • Ethan

    It was surprising how subtle that assumption can be, and how it can work its way into things.

    Another issue I ran into was updating the screen after the user changes the window size or changes screen orientation. It takes the browser object a while (about a tenth of a second) to get the new viewport dimensions - so you can clear the screen when the browser On resized event fires, but you have to add a Wait to get the new dimensions and update where things should be.

  • Ethan,

    That is working correctly. With unbounded scrolling, viewport(left) could be anything: 12,453,121 or -7,231

    so adding viewport(left) + viewport(right) may give you a very large positive or negative number - way bigger than the width of the screen.

    You want to set the sprite width to viewport(right) - viewport(left)

    a couple months ago I was working on an app that always used the full screen on a cell phone by using unbounded scrolling. I was amazed at how many bugs I created because of assuming viewport(left) is zero. Things like centring a button on the screen - you would think it is the width divided by two (viewport(right) - viewport(left)) / 2. But that assumes the left edge is at 0. So, you have to always start from the actual left viewport coordinate and do something like:

    ViewportLeft("HUD") + (ViewportRight("HUD") - ViewportLeft("HUD")) / 2

    And, of course, you have to remember that the top of the screen isn't zero either.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hookecho

    Yeah, I would check how many objects there are at the start and later when things bog down. It could be something like every bullet you fire is still flying out there way off screen, or other objects building up over time. Check how many collision checks it is doing. make sure anything off screen is not doing stuff that is cpu intensive...

  • swad

    at start of layout, you can add an action for your button to "Set css style" (it is right at the top of the dialog box).

  • Smedis2

    There is no simple way, so, like Newt said, using blend modes can give you the effect you want. To do that you have to put the sprite on a layer that forces its own texture, then put a "mask" sprite that has its blend mode set to Destination Out on top of the mummy sprite. The mask sprite has to be on the same layer...

    I made a quick demo... http://www.rieperts.com/games/forum/MummyReveal.capx

    I tried it 3 different ways:

    1) Reveal - just like your sample, the mask lifts up.

    2) Pop up - where the mummy pops up from behind the mask

    3) Adjusting the Height of the mummy from zero to 100%. This method does not need a mask. or a layer that forces its own texture but might not look as nice. It sort of looks like the image was lying down flat and "flips" upright...

  • Mallets

    Is there a reason you want each character to be its own object? are you animating them somehow? or applying effects to each character?

    I think it "freezes" for a couple seconds because of the overhead in creating 7000+ instances of the spritefont. The text file should load almost instantly. One thing you can do is load the text at the beginning of the first layout so it is available when/if you need it. Or maintain the credits in the text file, but then copy all the text into a text global variable (you have to remove carriage returns, but you can add them back at the beginning by replacing a place holder character).

    If you want everything to appear at once on the credit screen you can have a sprite block out the screen while the text is being created and then hide/destroy the blocking sprite to reveal everything when it is ready.

    I made a quick test to see what happens when you create 7000+ spritefonts... then added the ability to do one big spritefont instance, and paragraph by paragraph. You can try my test here: http://www.rieperts.com/games/forum/Font_Render.capx

    as you can see, it takes no time at all to create one instance, or a couple dozen paragraphs. But the individual character method does take a while to complete. I added bullet behavior to the font, so that something happens when you move the mouse over the text...

  • martdsam

    The cursor is staying the correct size (4x4 pixels), it is the rest of the layout that is getting scaled to a larger size.

    If you go to Project Properties, and turn Fullscreen Mode to Off (instead of Letterbox Integer Scale), the layout and the cursor should look the way you expect - although it might be smaller than you want.

    A mouse cursor does not scale with a layout...

  • Add me to the list too!

  • Phoenixbowman

    I highly doubt the random variables are heating up your phone. The main reason why a phone heats up is that C2 can only use a single core of a processor - except for a few things that can be handed off in some cases. The more commands the event sheet has to process every tick, the more the phone will warm up. 15 random number generators is not enough to cause a problem. But something else is building up over time and making your phone do more work than you may think.

    So, make sure you don't have unnecessary things running - and the fact that you say the game start to lag after a while tells me that more is going on than you realize. Either objects aren't getting deleted, or some condition is true multiple times that is spawning too many new objects, or something like that. It is probably bugs in your code, or too many effects, or too many or too big graphics.

  • mchulet

    ok, try this... it is multi-touch friendly, touch any clock hand to move it, It you have enough fingers you can move all the hands simultaneously...

    http://www.rieperts.com/games/forum/clock2.capx

  • I have been working on a database front end. The screen shot below is from my desktop, but it also runs solid at 60 fps on my old iPhone 5s (running 8.4.1 - so not benefiting from newer iOS improvements). The CPU usage on my phone settles around 42%, but draw calls are only 2% (and only 0.4% on my desktop when nothing is moving).

    the bulk of the CPU usage is from the collision checks (12,000 a second) which is checking if the mouse is over a data line, and then highlights the line. If I turn that off, the collision checks go away, and the cpu usage drops way down on my phone.

    Many of the 1146 objects on this screen are spritefont objects (over 800), so it obviously benefits from drawing the same object many times - although each object has different text to display. My eventsheet for this layout has 1,381 events at the moment - in dozens of functions. Code only gets called when needed. When nothing is happening there is almost no code running...

    I use 6 layers, one of which forces its own texture, because it needs to mask out areas to make a scrollable pop-up window. So, for what I am doing, the engine seems to work very well.

  • ErudioLtd Magistross

    for future reference - you can set the z-order of the form elements to change the tab order.

  • mchulet

    like NoSoul8 said, the hour hand moves 30 degrees per hour (360/12). The minute hand moves 6 degrees per minute (360/60).

    Since there are 60 minutes in an hour, that means that the hour hand moves 30/60 or 0.5 degrees every minute. So, you take the number of minutes and multiply it by how much the hour hand moves per minute:

    if the minute hand at the 6 on the clock face (30 minutes after hour), the hour hand should be half way between two hours (30 minutes x 0.5 = 15 degrees).

    if the minute hand is at the 9, then the hour hand should be at 45 minutes x 0.5 or 22.5 degrees past the hour it started at.

    if the minute hand is at the 2, then the hour hand should be at 10 minutes x 0.5 or 5 degrees past the hour it started at...

    so, if the time is 4:15 then the hour hand will be at 4 x 30 + 15 x 0.5 = 127.5 degrees, which will place it a quarter of the way past the 4.

    (obviously, you still have to add in the 270 degrees to get the hands positioned relative to 12 o'clock, because C2 thinks zero degrees is at 3 o'clock)

  • mumu64

    I have used on touch on many iphones with no trouble. On Click refers to mouse input and will not respond to a touch, On Touch will respond to a touch and a mouse click (unless you tell the Touch object to not also act as a mouse).

    so make sure you aren't mixing up your events...