tarek2's Forum Posts

  • tarek2

    Thank you very much again!

    I'll read everything you've explained and read the content of the links! This helps a lot!

    After understanding everything, I will redo the game completely, after all, I had not done much until now xD

    And when I finish the game, if you want, I can send a link to the game.

    It's really simple, it's a different version of Ghost Shooter, but with an archer and monsters for him to kill, and I did pretty cool animations of just about everything (at least I think they're cool hahah), actually I'm just doing it to understand how Construct 2 works, to be able to apply what I learned in a more complete and nice game.

    Your Welcome m8

    Sure I would love to test it and see what you come up, the Game it sounds a really cool idea

  • Try Construct 3

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

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

    Your Welcome m8, I'm glad to help

    1-The short answer is No

    Let's go back the Basics:

    Construc2 Runs the Events from top to bottom

    Now you have "Top Events" and you have "SubEvents"

    "Top Events" = To the First Event where all the action starts, it can have many conditions, here is where you Start the Picking for the (Objects or Variables, etc...) to who you want to apply your Actions.

    As longs as the Conditions are true it will always run their actions plus any subevents.

    Just to make sure you follow me I'm gonna point you the Top Events from the "Capx example" that I gave you

    Event: (1, 6, 8, 11, 12) are all Top Events the ones with Green Arrow are "Triggers" by the way which means they run once only when they trigger, but for now, lets refer to them as top events

    So now as for your question (Bullet On collision with Player) has just one condition if is true will always Trigger & Run his actions and subEvents

    "SubEvents" = is an Event under the rule of the "Top Event" ins the name SubEvent.

    Now these works different, the subEvents will Never run unless the "Top Event" runs.

    so is like saying

    -Unless the bullet hit the player the subEvents (2 & 4) will never be checked

    -Unless event (6) Triggers SubEvent(7) will never be checked

    -Unless (8) Triggers SubEvent(9) will never be checked

    SubEvents have many benefits example to help you filter more the Picking into a different Groups, another one is to help organise your Events and structures so your code becomes easier and simple to understand, plus probably more things that I cant remember

    ======================================================================

    2-Here we have two things going on

    -The first you need to understand that I would like to use and Else as you can see on SubEvent 4 to separate the logic into two categories

    -The first category = equal to if the Health is (equal or greater) than 1 then run these Actions and subEvents

    -Else = if the Health is lower than 1 then Run these actions and subevents instead

    so I have to separate the event 2 from 3 because other ways if I put them together it can mess up the Else on event 4 also is to help me understand the events much quicker because the else is related to the player's Health not to the Hearts so it makes sense to separate event 2 from 3

    So the answer why event 2 has no actions is empty because I use it just to filter players health is => than 1 so I can use the else on event 4

    =======================================================================

    3-Here "Frame" is an Instance Variable of Hearts be careful don't confuse it with the hearts "Animation Frame" you can change the name to a different one if you wish if you think it will confuse you.

    you can do this by clicking on each heart and on the left properties panel look for the section that says "Instance Variables" there you will find one Variable which is "Frame" you can change it to your needs.

    Also there you can see the Values of the hearts example

    You have 5 hearts

    Heart "Frame" = 4

    Heart "Frame" = 3

    Heart "Frame" = 2

    Heart "Frame" = 1

    Heart "Frame" = 0

    So in event 3 or 5 when we ask if heart "Frame" = to players Health it will Pick the heart that has "Frame" = players health

    Example

    Players health = 1

    sub event will pick only the Heart "Frame" = 1

    That's how c2 knows wich heart to Pick as we don't have any two hearts with the same value there is no confusion

    ====================================================================

    4-I explained it on the answer 2

    ====================================================================

    5-Yes, Timers has many benefits, one is to replicate what you were trying to do with the "waits" but the difference is that

    -Timers Are independents to the object or instances that are calling them

    if an object calls a Timer for 2 seconds then the Actions will not trigger until the Timer stops

    Example:

    Event 3 Picks the right heart and starts the Timer for 1.83

    on Timer ended then >>>event 6 will trigger and Pick the heart who called the Timer

    ==============================================================

    6-AFTER the 1.83seconds the Event 6 Triggers and run their Actions

    -you create and you can choose any name you like but make sure you put the exact name when you call the Timer as when you call the Trigger

    example

    event 3 and event 6 both reference the same Name "Hide_Heart" so they are linked

    -Yes event 6 will only Run if you call the Timer first like in event 3 or 5

    ===============================================================

    7-Normally most of the games they link Players Health with the HUD display, where they show the players Health like I did with the Txt object on the screen showing the Health.

    Now I don't know if it will happen in your game but there is the possibility that example 20 Bullets hit the Player at the same time and if the player was already Health = 1 then it should go down to -19

    making the HUD health looking -19 which is weird at list I didn't see it yet on any Game Health going down less than 0

    So the short answer is to limit and reset Health so it doesn't go under -0

    ====================================================================

    8-When you leave an event empty it becomes like "Every Thick"

    -So the Event reads like >>>Every thick update the Txt to display Health

    Note this part is just for debugging where I like to use Txt and update every thick but you should know that this way is very Cpu demanding and is not the correct way of doing it if you wanna display on an exported Game

    The correct way will be to use

    -Sprite Fonts

    -Update the Txt only when you need it, example you could delete event 8 and just update the Txt on event 1 because is when we manipulate the Health, I didn't do it because I didn't want to add more actions there to confuse I prefer to leave them clean just the action related to the event to avoid any confusion

    I hope I clarified all your questions

    Special recommendation for you to check Asap

    https://www.scirra.com/manual/75/how-events-work

    https://www.scirra.com/manual/167/timer

    https://www.scirra.com/manual/134/performance-tips

    https://www.scirra.com/blog/83/optimisation-dont-waste-your-time

    https://www.scirra.com/manual/73/instance-variables

    https://www.scirra.com/tutorials/253/how-to-make-a-platform-game

    https://www.scirra.com/tutorials/243/building-a-platform-game-a-beginners-guide

  • juniorasmj

    Your Welcome

    juniorasmj One thing I can understand why you like to create extra events, is it really necessary?

    Since you did the same set up again every "Health Check" separate on his own Event I take it as you wanna do

    -Every 1 Health substracted then Play destroy animation for a specific Heart Right?

    So if you insist on doing it on separate Events dop2000 give you the best solution use "Else" so you can skip all the events bellow once one of the (Health events check) is true and save extra checkings

    But why not do it even simpler

    you must have a (trigger Event) where you subtract the Health

    Example say the Trigger Event is : bullet on collision with Player >>> subtract 1 from Health

    Then why not Run all the Logic under that Trigger so all the Health checks run only if is necessary

    Example Capx:

    https://www.dropbox.com/s/xfitbgehdm5p220/StopAnimationLoop1.capx?dl=0

    Also, use Timers as Doop200 recommended other ways you will keep having Problems that you cannot Debug, you have so many waits there

    Even the Hearts Probably you can combine all of them in one instead of having 5 separates ones

  • I just downloaded your file and it didn't work on mine. That's really weird.

    The code provided by Sebastian works as is intended for me >>>>Stops when you touch & toggles on/of

    which part are you referring that doesn't work for you the( Stop or the Resume)?

    as you mention in your original post this

    [quote:158v8sm6]This code doesn't work. I am not sure why when the boolean is toggled that the pathfinding doesn't stop / resume.

    If you are referring to "Resume" the movement to the Path after the Player stops then the problem is because you need to recalculate a new Path after you stop the Pathfinder

    see if this works for you

    https://www.dropbox.com/s/jd6n8ozxcxafif6/1-PathFinder%20Stop%26Resum.capx?dl=0

  • juniorasmj

    Once any of your events meet the conditions will be always true unless it becomes false, to avoid this as you wanna change the animations once you will need to an extra condition "Trigger once While true" that will make the event trigger once only also set the animation loop to no on the sprite animation properties

    Another thing the four first events is the same thing repeated four times you could do something like

    -Health is <= 4

    -Add One more condition: Health is => 1

    -Trigger once while true

    >>>>>>>>>>>>>>>>>>>>>>>>Then your Actions

    Else

    Health is <= 0 :

    -Trigger once while true:>>>>>>> your actions + set Health to = 0

  • [quote:rdlyqaic]This kind of report is really confusing. I could probably fix two other bugs in the time it just takes to read this much information, watch the videos, and figure out exactly which problem you're talking about

    Hmm confused? the thread Points to "High Cpu" across the whole page like 100 times, and if you go straight to the "Observed "Result" & "Expected Result" It gives the short version of the Problem

    Technically the videos it was to help you to avoid ("read this much information")

    Anyway thanks for checking it

    [quote:rdlyqaic](since it appears to have changed at some point during this thread).

    Nothing at all has been changed on this thread just the Title from "App Memory Leak" to "High CPU (App) In All The iphones"

    Thread started with a

    Capx and Video of >>Coccon Canvas+ : >>>but since is not supported anymore and you asked if the problem happens in different platforms then the Thread ended up with a

    Video of >>> PhoneGap: showing the "High Cpu" swell

    [quote:rdlyqaic]Can you file a new bug and basically try to keep it as concise as possible? Stick to officially supported platforms only, a minimal repro project, clear steps to follow, and the expected and observed result.

    Sure no problem I will make sure is short the next Time, I apologize

    [quote:rdlyqaic]I'd point out that the CPU usage in Construct is a timer-based estimate. It's not very accurate for mobile devices because of the way they throttle to save power. I investigated another "high CPU" iOS bug and it just turned out to be this. In maximum performance mode, it might be using something like 9% CPU - hardly any. However if the OS determines it's not that busy, it might throttle down the CPU to be 10x slower, in order to save battery life. However now a timer-based CPU usage measurement indicates 90% CPU! That's a misleading number. Due to this power throttling, you can see a counter-intuitive effect where as you create more objects and add more CPU work, the measured CPU usage actually drops as it kicks up in to a higher performance mode and completes the same work quicker.

    Cool Thanks very much for your explanation, I got now a good understanding on how Construct works, I thought (timer-based estimate. It's not very accurate) it applied to when we test projects over Wifi only

    so it looks like this is not the case then, Even exported Capx and installed on the phones there is no way to test the real performance within Construct, I understand now

    [quote:rdlyqaic]So I'd guess any "high CPU on mobile" bugs probably just come down to this. It'd be best to use another app to measure the real CPU usage on the system if possible.

    Thanks for the suggestion I will try that

    Since "Construct is a timer-based estimate. It's not very accurate for mobile devices" then I think you can close this bug as there is nothing more we can discuss at the moment, I will have to look with different "Cpu Checker" and if I find anything I will open a new bug like you said

    Thanks very much for your Time

  • [quote:9jd9nfxy]jook00 What you mean with has been discontinued??

    tarek2 Construct no longer supports Canvas+ according to this message from Ashley in 2015. You'll also notice this as Construct 3 to Cocoon with Canvas+ will render a game with scaling and sound issues. However, I've been using Canvas+ on all my games and didn't even know it was discontinued until now.

    Ashley's message on no canvas+ support:

    https://www.scirra.com/blog/154/evolving-construct-2s-export-options

    Scaling issue seen here:

    https://shatter-box.com/knowledgebase/build-construct-3-games-cocoon/

    Haah ok I didn't know it was discontinued either haha, thanks for the links that cleared up many questions I had.

    I'm glad that I found out those things before will be to late.

  • Hi Ashley

    [quote:3a1hq21b]The original report mentions a memory leak

    I thought that could be the problem but is true I changed the Tittle to more appropriate one "High CPU (App) In All The iphones"

    [quote:3a1hq21b]we haven't officially supported Canvas+ for years.

    ok thanks, I didn't know that now makes more sense the Toby statement, I'm not sure why you would stop support on canvas+ obiosly you must have your reasons but for what I saw is super fast and useful platform to use, I could see how anyone using construct will benefit from Canvas+ as there is a huge gap between WebView and canvas I mean big you cant compare them, webview runs all the Games at 90%Cpu Extra super slow than a Game exported With Canvas, you can see the diference with any iphone from 7 and all the iphones that came after

    [quote:3a1hq21b]Does the memory leak occur using PhoneGap Build

    Yes it does at least for me,

    Any Game exported by "PhoneGap" or "Coccon WebView" Runs at 95% Cpu in all the iPhones, doesn't matter if is simple Game with not many events or if is more advanced Game with much more events

    Plus another Hint to see that something is going on is how can the same Game run at 95%Cpu on an Iphone6 and then Runs exactly at 95%Cpu on an iphone (8 or X) which are way faster and more advanced than iphone6.

    Shouldn't be run at much much lower CPU at least on the latest Phones?? so here you have a clear evidence that is something affecting the Cpu pushing the phones to the limits doesn't matter how fast is the phone, it looks like doesn't matter how advanced the technology is advancing on phones doesn't help to construct it will always give the same speed and Performance.

    Here is the Video Test was done on (iPhone 8 Plus) Exported with PhoneGap,

    Iphone X gives the same performance as is exactly the same chip

    Video: I used the same Capx linked in my first post

    https://www.dropbox.com/s/luun7tld3y9c9 ... t.mp4?dl=0

    Are these things be fixed in the New Run Time??

  • Euma

    Enemies: boy, girl, bird On Collision With Main

    Second Condition: Main is SpeedPlus <<<<<Inverted to become false

    That it should make the Character Immune while is on speed PowerUp

    Or you can create another Boolean if you wish example "Immune" and do the same thing as above

    Another thing you can shorten your events a lot by grouping the repeated events like Main on collision with enemies you can put all your enemies if you can use "Families" and do something like Main on collision with Familie >>> do your Actions

    if you cannot use Families you can try swell to put all the enemies in one sprite and just change the animations

    and do the same as above

    Main on collision with Sprite >>>> do your staff

    And many more things you can shorten apart from collisions Events if you look carefully

  • For the last 4 Months, I have been stragling with this issue I been testing to death untill I can handle it any more, there is nothing you can do or at last, nothing worked for me.

    There is a huge gap between Webview and Canvas+

    The Games that run smoothly at 7% Cpu on canvas run at 98% Cpu on Webview with the stutters all the time,

    Here is what I noticed with webview

    -The code gets executed much much slower with delays

    -stutters

    -Any minimum loop will break the Game and make the stutters unplayable

    -it cannot handle loops like the "For Each" , "For" ," While" or anything that needs to Pick by looping a little bit

    -The Gameplay feels slow much boring

    Canvas+

    -Amazingly fast, I was surprised with speed and the super low Cpu and steady Fps

    -but has a critical bug I reported here

    https://www.scirra.com/forum/app-memory-leak-closing-or-changing-layout_t201156

    Now the Problem becomes bigger because if you wanna use Canvas+ Not all the phones can handle it I don't know why

    Canvas+ works great on iPhone ("7" & "8" & "X") including using any loops

    but it doesn't work on iPhone 6 or less, the stutters are very noticeable making the Game unplayable

    So hence I have the big battle to choose canvas+ and loss the big market of iPhone 6 and less, which is huge market probably still half of the users of the Apple or choose Webview slow with stutters Plus removing crucial elements of the Game like the Pathfinder which it cannot handle the Webview on Iphone6 or less

    I'm so angry right not because I lost 4 full months with this and I didn't find any solution like you said on wifi works everything good and smooth but when you export it is a nightmare

    PhoneGap is out of the equation

    ===========================================

    [quote:1koqt2fi]Since Canvas+ has been discontinued

    jook00 What you mean with has been discontinued??

  • piccolodmq Nothing to be a shame we all been there we did a lot of mistakes swell and we still keep doing till today, the fact that you still keep learning and working on it is big accomplishment keep it up.

    On Collision Event normally Picks the objects involved in the collisions individually that's why you didn't need the extra for Each on that situation, any Actions you apply to the KopaTropa on events like this c2 will pick the rights ones individually and apply those Actions to the Right Kopas

    I love the Tittle by the way "Immortal Enemies"

  • piccolodmq

    "Immortal Enemies" lol I'm not surprised they should be Titans

    Did you realize that you have three "For Each" in arrow and in a sub-events? and that you don't need any of them

    Plus the trigger once in event 43 is making you a big mess there combined with the Waits

    Remove all the "For Each" three of them

    Set event 41 as the top event

    --SubEvent: Kopatropa Health = 1 >>>> your Actions

    --Else Health <= 0 >>>>>>>>>your Actions

    Also, I would remove all the waits, replace them with Timers

    try and see how it goes

  • ivall

    Is hard to say without seeing your project as it should work, but the first thing I will look will be if the Layout "gra" has linked properly to the Event sheet where you have the code which is "gra" Event Sheet

    -Click on the Layout "gra"

    -At the left in the Properties Panel like you show in your first picture check where it says "Event Sheet" it should be >>> gra

    -if it doesn't show gra just change it to gra and it should work

    -but if you have "gra" already and is not working then the problem it should be somewhere else, if you post a minimum capx someone can have look and fix it much quicker

  • tarek2

    Ah great! I tried it how you explained and it works perfectly now! Thank you very much

    Your Welcome

  • RioLuk

    Use Overlap for that much better

    -sprBullet : Overlaps sprEnemy

    -sprEnemy: pick top instance

    -Trigger once while True

    Action :sprEnemy: destroy

    The 3 conditions in the same Event