lionz's Forum Posts

  • You must be resetting global variables or setting it to 0 on start of layout.

  • There are probably many ways to do it. If i was to do it my approach would be to have 5 variables on the space called ID,left,right,up,down and these are numbers. If the 4 directional variables are 0 it means you cannot move in that direction but if they are populated with a number greater than 0 it means you can move to the space that has that ID.

    On the movements events it would be left key pressed checks the left variable of the space you are on, right key pressed checks the right variable of the space you are on etc. So as an example if you are on that starting space which has a variable space.down=2 and the space below it in the picture has an ID of 2, it means on down pressed you can move to 2. If it was space.down=0 then you wouldn't be able to move. And if the starting space has an ID of 1, then the space below it which has an ID of 2 would have a variable space.up=1.

  • These long discussions is what PMs used to be for I suppose. At least you understand the logic enough to see the bugs and kind of know where to fix them so that should be enough to get you going. If you get blocked you will simply have to share the project at that point )

  • Those 3 values were an example, in the game they are unknown so you have to set ballcolor to rgb(of a sprite). Maybe someone knows how to extract those values, but I fixed it the other way :P

  • You wouldnt need instance variables to track that but rather some logic around powerup dropped onto a powerup, set the powerup in the slot back to its original position and leave the new one in the slot.

  • Because I don't know how to extract rgb and not sure if possible, the best I can do to minimize the code is this, where you go into the layout and set 3 instance variables on the ball to its rgb. Maybe that helps, it does avoid typing them all out in the event sheet. :)

    dropbox.com/scl/fi/br2pz1xkk10x3o0h73lvo/ColorTests.c3p

  • You can make an inst var = another inst var but you already have too many. How does your game work? Do you need to see the dropping of powerups onto slots? Where are you dragging them from and do they swap? So the text is displaying the instance variable on the slot that seems fair. The redundant bit is the ability having instance variables called slot1 active etc. I don't know if it will work for your game but the best thing is to have the actual slot with the powerup images as frames and set these. It sounds like you are moving the powerup objects from place to place when there may be no need to do that but I don't know how your game works.

  • I think the slot should be using an instance variable, not an assigned text object. The variables for slot active are not required from what I'm reading. You don't need to say powerup A is active on slot1 by the way of an instance variable on the powerup, you would just have it equipped on slot1. If you can drag a powerup over a slot and replace one then I'm not sure if a check to see if something is in the slot is required either? You could resolve this by getting rid of the slot active instance variables. The slot active boolean could remain if the slot can be disabled so you can't drop powerups into it.

  • If you know in advance what you want to set it to like you are describing here then you could set the global variable to a string i.e. "140,176,136" then on object clicked set colour to rgbEx(int(tokenat(variable1,0,",")),int(tokenat(variable1,1,",")),int(tokenat(variable1,2,",")))

    It may look scary but this is just splitting out the 3 numbers in the string and setting the rgb parameters to each number, where 'variable1' is the global variable. But yeah, this may be the reverse of what you want.

  • I kind of get what you're asking but I don't quite grasp the reasoning behind it, it's for more efficient events? I know how to assign an rgb or colour to a sprite based on a global variable, as for extracting the rgb from a sprite, I'm not sure if that is possible of if it's needed. There is probably an easy way of doing what you want, how does the game work with the colour setting?

  • floor rounds it to a whole number because random can pick any number between ranges and you want a nice round co-ordinate instead of something like 8.74. No problem, gl :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't quite follow as they're your events, right? :). Look at manual for random(x,y) it picks a random number between the ranges. When you add or subtract an amount from the zombie Y you are moving it up or down the screen so it will spawn above or below the zombie. If you do the same for zombie X then it moves the diamonds to the left or right of the zombie.

  • Hiya, I took a look at your game and the enemies are bullets that rotate towards the player so they would ignore the wall. I don't know how you want to use the line of sight behaviour, but as an example you can add the line of sight behaviour to the enemy. Then you say in the logic, if enemy has line of sight of player, enable the projectile, if enemy does not have line of sight of the player, disable the projectile. This would create something where the enemy only moves if you are close. It really depends on how your game will work. You can read more about LOS in the manual.

  • Your Y is set to zombie.x instead of zombie.y

  • Do you mean using line of sight behaviour? It should be set to Obstacles=Solids by default, check that this is still the case.