Yann's Forum Posts

  • and the change of speed is important to avoid losing trajectory

  • If what you want to do is knowing what is the card you have, don't forget that just the number 0 to 51 can represent it, 'cause a deck of classical card is just a grid. you have color (spades (?), hearts (?), diamonds (?) and clubs (?)), on the rows and values (1,2,...,Q,K,A) on the columns

    So basically if you choose to order things like in your animation in the Card sprite :

    for colors

    • 0 = clubs
    • 1 = diamond
    • 2 = hearts
    • 3 = spades

    for values

    • 0 = 2 (ok it's a bit counter intuitive but heh...)
    • 1 = 3
    • ...
    • 12 = K
    • 12 = A

    so you have a grid with 4 rows and 13 columns

    the number 0 = the 2 of clubs

    the number 51 = the Ace of spades

    So basically you don't need any 3 dimensionnal array, all the informations are in the number representing the card

    You just have to extract it as I did for placing cards

    CardDeck.At(DeckCardNumber) is the number

    to get the value it's like the X calculation

    value = CardDeck.At(DeckCardNumber)%13

    color is like the Y calculation

    color = floor(CardDeck.At(DeckCardNumber)/13)

    then you have your card (:

    let's try the number 16

    value = 16%13 = 3 it's a 4

    color = floor(16/13) = 1 it's a diamond

    16 = 4 of diamonds

    easy peasy :D

  • (: glad you like it, hope you understood how it works

  • well... your event sheet is a mess

    bring the capix I'll show you

  • Ok RingtailCafe so your way is better until a family system (:

    (or maybe you put all the behavior in the sprite and activate/deactive the one you want to use depending on th ID... should work :D)

  • Maxum, your way to shuffle is awesome. I never thought of something like that to permutate stuff around the first index from loop to loop is great.

    I would have done something like keeping a string of 52 tokens and just pick randomly each token, fill the Array and delete them, until there's no token to pick.

    But your way is far better.

    The rest of the code is a bit heavy though, so let me show you how to simplify :

    shuffleCard.capx

    in just 14 events

    vidi I don't know if there's a tuto, but in short you can set value to indexes like X or X,Y or X,Y,Z

    Array is just a data container. Test some stuff and come back with question if you don't understand what's going on.Yann2011-11-05 13:24:37

  • Well, every body's waiting for the "family" feature to come (:

    Families will allow you to "group" same kind of elements (sprite or tiled background, or text) under the same name and manipulate shared properties (similar instance variable and behavior) as I did here. Just, as ou said, these element will be able to have different behaviors/variables.

    Pode: you mean... the car in the other thread about car AI ?

  • hop! That's for you

    canonBall.capx

  • ok the forum ate my explanation ;_;

    just take that and be appy

    carAI.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Set layer 0 scale to layerscale(0) + 0.3*dt

  • Hey thanks for the tip. Changing character like that can trigger cool gameplay idea

    I looked at how you did it and it made me want to make my own.

    It's just 4 events, and as long as there's no family system, it is easier to use if you want to add other gameplay logic like life/death system.

    You don't need to do things 3 times for each character.

    CharacterChanging.capx

  • Your game has enemies that shoot horizontally, And I can more or less feel that you only want the enemies to shot when you are at their level.

    The easiest way to achieve that is to put some invisible detection box that will do the work for you.

    And I think you can make the system work with :

    Every Tick 
          -> Enemy.active = false
    
    detectionBox is overlapping Player
    detectionBox is overlapping Enemy
    ---System : compare Abs(Player.X-Enemy.X)<200
          -> Enemy.active = true
    
    Is Enemy.active
    Every 1 seconds
    ---Player.X > Enemy.X
          -> Spawn Bullet
          -> Bullet set angle to 0
    ---Player.X < Enemy.X
          -> Spawn Bullet
          -> Bullet set angle to 180

    Enemy.active is a BOOLEAN instance variable.

    I set it to false every tick and then if the player and the enemy is over the same detection box, it is set to true (the event are read from top to bottom every tick before the system draw the result)

    After that, in sub event I check for horizontal distance by checking how many pixel they are appart (with the abs() I don't care if the player is on the left or right of the enemy)

    And then if the Enemy.active is set to true I make it spawn bullet at the correct angle (in your game it seems that you always fire horizontally so 0? or 180?)

    And that's it

  • Yeah, I understand, the ability to draw in CC's image editor was really handy for quick blocky prototyping.

    Also, the absence of homothetic resizing can be annoying sometimes.

    But nothing really limitating, you can still create some quick square and circle for fast prototyping in an external app or use the sprite packs has placeholder. And for resizing, a simple calculation can do the trick.

    So I understand why it's not already here. C2 is still growing... Just have to be patient and cope with any weirdness (:

  • Yeah it was just to make things clear about the fact that it wasn't a project image file that I tried to change but the image files from which I created the sprite by loading them.

    <img src="http://dl.dropbox.com/u/23551572/C2/Report/leftOpen.jpg" border="0" />

  • To be sure we are talking about the same thing, I didn't use the "save as project" and then change a the png of a sprite.

    I used the "save as single file" during all the production of the game.

    So I guess changing a png I imported, to reimport a modified version afterward shouldn't confuse C2.

    As far as I understand how C2 works, once you load a png C2 isn't supposed to keep any link to the file... is it ?