How to add score just once, and event question

0 favourites
  • 8 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • Hello, super noob in Construct2 is here<img src="smileys/smiley19.gif" border="0" align="middle" />

    I have some problem with my game prototype

    <img src="http://i56.photobucket.com/albums/g183/raindropmemory/ScirraConstruct/1.gif" border="0" />

    In my game, there is player and monster. When Player collide with monster, then it will add 1 to global variable "Score"

    PROBLEM here is:, it always add one more score every time player collide with the monster. But actually, I want it to add just only once. <img src="smileys/smiley19.gif" border="0" align="middle" />

    <img src="http://i56.photobucket.com/albums/g183/raindropmemory/ScirraConstruct/2.gif" border="0" />

    2) There is the "Panel" sprite in my game, when player overlap it, it will have message sprite pop up, telling that player should got 5 "Score"(global variable) to finish the game.

    PROBLEM here is: I would like to make the message sprite appear every time player overlap with the panel. But somehow it appear just only once!

    <img src="http://i56.photobucket.com/albums/g183/raindropmemory/ScirraConstruct/3.gif" border="0" />

    3) When the player got 5 Scores, I would like the panel sprite to display sprite message, telling player that they finish the game.

    PROBLEM IS: I can't make the message to appear, even though the Score reach "5"

    Thank you very much for your help.

    Love Construct! <img src="smileys/smiley4.gif" border="0" align="middle" />

    This is the .capx file with comment

    dl.dropbox.com/u/363243/Construct_Ask/01_2011_8_Message%20and%20Score/AskConstruct.capx

  • 1. You need to modify event2.

    Create a new event, System - Trigger once while true.

    Add the Collision event/condition (between player and monster) to it, as well as you add 1 to score.

    It now works.

    Unfortunately, you can't add the "Trigger once" as "Add another condition", that's why you have to create a new event. But this will correct your "bug".

    2. The problem comes from the fade behavior.

    I don't master it, but instead of making msg_needmore visible, set its opacity to 100.

    Here you go, the msg_more appears again. But the fade behavior does not retrigger. (so the second time, msg_more just stays up, and does not fade again)

    I guess you could handle the fading in events. (msg_needmore.opacity = msg_needmore.opacity - 1 until it's 0)

    3. Once again, the fade behavior seems making trouble.

    I removed it from msg_goodjob.

    I also modified event4 so that it is only "System.Score is greater or equal 5".

    Once my score reaches 5, msg_goodjob displays.

    I guess previously the fade behavior, already had it disappeared and so, setting it to visible didn't work as its opacity was 0 anyway.

    So same as 2. you should handle fading in events.

    Hope it helps. Nice gfx in your project ;)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Kyatric, Thank you very much for your help. <img src="smileys/smiley4.gif" border="0" align="middle">

    Your suggestion about Trigger once condition is superb. It works! (I didn't aware of its existence until you point out) <img src="smileys/smiley20.gif" border="0" align="middle">

    About the fading message problem, finally I found a way to do it by chance(which is actually really simple)

    When player collide with the "Panel", I then create the condition "System---> Create object"(which is the message sprite I want), instead of adjusting with visible or opacity as I did in previous time.

    and it now work perfectly, also with proper fade behavior! <img src="smileys/smiley4.gif" border="0" align="middle">

    Try it here if you which:

    Note: Catch the 3 flying object to trigger the 'Good Job' message at the panel.

    http://dl.dropbox.com/u/363243/Construct_Ask/01_2011_8_Message%20and%20Score/askTutorial/index.html

    P.S. For some reason, I found that sometimes some event is not properly triggered, but after I delete that event and create the new one with the same event and condition, it happened to work just fine!

    (maybe a bug in Construct?)

    and here, in case anyone want to look at the .capx file.

    http://dl.dropbox.com/u/363243/Construct_Ask/01_2011_8_Message%20and%20Score/AskConstruct%20-%20Final.capx

  • About the fading message problem, finally I found a way to do it by chance(which is actually really simple)

    When player collide with the "Panel", I then create the condition "System---> Create object"(which is the message sprite I want), instead of adjusting with visible or opacity as I did in previous time.

    and it now work perfectly, also with proper fade behavior! <img src="smileys/smiley4.gif" border="0" align="middle">

    Indeed that works and work well, cool workaround.

    P.S. For some reason, I found that sometimes some event is not properly triggered, but after I delete that event and create the new one with the same event and condition, it happened to work just fine!

    (maybe a bug in Construct?)

    It's possible that it's a bug.

    If you can reproduce the bugging events in a .capx and report it in the bug section with the informations required in this post, I'm sure Ashley will take a close look into it.

    Finaly concerning your game : You have an image moving in the background in peculiar which has a green background. And it is possible to see a "low flickering" between this green background and the white background of the layout. Either change the color of the background, or make this image's background transparent for more continuity.

    Keep up the good work.

  • Thank you Kyatric for the tip about bug report and moving background.   <img src="smileys/smiley20.gif" border="0" align="middle" />

    By the way, I would like to ask about my new problem, that I still can't find the solution after several hours of trial and error.

    Situation is, I would like to display the sprite that will disappear, and change to next one when user press any key. You know, like the page of tutorial that user read before they play the game, page by page.

    <img src="http://i56.photobucket.com/albums/g183/raindropmemory/ScirraConstruct/pressanykey.png" border="0" />

    It sound very simple, but I can't find a way to do it right. Would you mind enlighten me? <img src="smileys/smiley19.gif" border="0" align="middle" />

  • It depend, you have several ways of doing.

    Let's take this way were the tutSprite is made of 3 frames (the actual 3 images you're depicting). They are all part of the same sprite tutSprite.

    Make also a global variable "isTut" a number.

    We will test "isTut" to check if you are in the tutorial or not during the execution of our app.

    Event - System Compare global variable - "isTut" = 1

    ..Sub Event - Keyboard - On any key pressed

    Other condition of this subevent^ - tutSprite - Compare animation frame - Frame is equal 1

    ....Action tutSprite - Set animation frame to 2

    ..Sub Event - Keyboard - On any key pressed

    Other condition of this subevent^ - tutSprite - Compare animation frame - Frame is equal 2

    ....Action tutSprite - Set animation frame to 3

    ..Sub Event - Keyboard - On any key pressed

    Other condition of this subevent^ - tutSprite - Compare animation frame - Frame is equal 3

    ....Action System - set global variable "isTut" to 0

    ....Action hide tutSprite, or destroy it, or whatever...

    When you make tutSprite appear, and display its frame 1, remember to set "isTut" to 1 to indicate "Tutorial is on".

    It is a way of doing, but not the only one.

    In the end, it all depends on the specifics of your project, and the effect you want to apply.

  • hey raindrop,

    groups seem a serious solution for a tutorial of this kind. i would take 3 global variables in your case...1 for curTut, 1 for curTutSprite and 1 for curTutTxt.

    everytime the user presses a key u increase the values and set the curTutTxt as u wish. also u set a group active. inside the group u check the 3 values, change the view and set the group inactive after the text and sprite has changed according to the state of the variables.

    i hope u understand what i mean. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Hi, big thanks for both Kyatric and xeed!

    but look like my knowledge in Construct is still at very early stage, thus I have a hard time understanding the the suggestion concept, and it sound too complex for my need.

    Though eventually(after I try again), I found the way to do it with simple event. I will upload my game soon so anyone can test it. <img src="smileys/smiley4.gif" border="0" align="middle" />

    Thank you again!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)