The game does not see the input of the "R" key, I use a
{
if keyboard_check_pressed(ord("R")) && global.died = true{
global.died = false;
room_restart();
}
}
If you are using a current version of GameMaker, the code in a script should be in a function, e.g.
function scrCheckRestart() {
if keyboard_check_pressed(ord("R")) && global.died = true{
global.died = false;
room_restart();
}
}
Related
I need to use two nested lists.
The first is a numeric list and the second is an alphabetical one.
When the second is over and I go to the first list, the numbers are counted from the beginning.
I tried to create a new list createList() but it didn't work
else if (object == ui->textEdit_left && event->type() == QEvent::KeyPress)
{
QTextCursor cursor = ui->textEdit_left->textCursor();
QTextListFormat::Style currentStyle = cursor.currentList()->format().style();
QTextBlockFormat format = cursor.blockFormat();
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
QTextListFormat::Style newStyle = createNewStyle(currentStyle, keyEvent->key());
if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter)
{
format.setIndent(format.indent() - 1);
cursor.setBlockFormat(format);
cursor.createList(newStyle);
return true;
}
else if (keyEvent->key() == Qt::Key_Tab)
{
format.setIndent(format.indent() + 1);
cursor.setBlockFormat(format);
cursor.createList(newStyle);
return true;
}
else
{
return false;
}
}
return false;
var colRange = getRange("Sheet1!G2:G200")
logger.log(colRange)
logger.log(colRange[0])
for(var i = 0; i < colRange.length; i++) {
if(activeCell.getColumn() == 7 && activeCell.getRow() == colRange[i] && ss.getActiveSheet().getName()=="Sheet1") {
newValue=e.value;
oldValue=e.oldValue;
if(!e.value) {
activeCell.setValue("");
}
else {
if (!e.oldValue) {
activeCell.setValue(newValue);
}
else {
activeCell.setValue(oldValue+', '+newValue);
}
}
}
}
Could anybody help with the for loop. Need it to check every row of column G to allow multiple drop down selections. If I replace colRange[i] with the specific row it does work. I assume I need to loop through each range G2, G3, G4, etc
Please explain what you are trying to
It's hard to figure out what you are trying to accomplish with you code but this is my best guess
function onEdit(e) {
const sh = e.range.getSheet();
if (e.range.columnStart == 7 && e.range.rowStart > 1 && sh.getName() == "Sheet1") {
if (!e.value) {
e.range.setValue("");//doesn't make sense it's already null
} else if (!e.oldValue) {
e.range.setValue(e.value);
} else {
e.range.setValue(oldValue + ', ' + newValue);
}
}
}
Learning Golang and was wondering if there is a shorter way to write this
if tiletype == 0 || tiletype == 2 {
levelmap[passage1block] = "wall"
} else {
levelmap[passage1block] = "floor"
}
Was thinking this would be the way though it does not work
if tiletype ==0,2 {
levelmap[passage1block] = "wall"
} else {
levelmap[passage1block] = "floor"
}
You can write a switch-case statement:
switch tiletype {
case 0,2: levelmap[passage1block]="wall"
default: levelmap[passage1block]="floor"
}
im trying to convert an android code into java using netbeans as IDE.
all the other conversion is done. a single line is still remaining because i don't know what equivalent function can be use here.
public BufferedImage[] SeprateText(BufferedImage newb3)
{
Color clr1,clr2,clr3,clr4;
for(int iht=0;iht<newb3.getHeight()-1;iht++)
{
if(chk==false)
{
clr1 = new Color(newb3.getRGB(0, iht));
if(clr1==Color.RED)
{
chk=true;
}
}
clr2 = new Color(newb3.getRGB(5, iht));
clr3 = new Color(newb3.getRGB(5, iht));
if(chk && ( clr2 == Color.BLACK || clr3 ==Color.WHITE ))
{
if(!sind)
{
sind=true;
index[count]=iht;
}
location[count]++;
clr4 = new Color(newb3.getRGB(0, iht+1));
if(clr4==Color.RED)
{
chk=false;
endloc[count]=iht;
barray[count] = Bitmap.create(newb3,0,index[count],
newb3.getWidth(),location[count]);
// this is the line. i dont know what function of bufferedImage can replace it
count++;
sind=false;
}
}
}
}
I am creating game like http://www.puzzlegames.org/814games-Connect-2-Game-game.html. so what should i add in connected() function?
fB and sB are First and second button selected.
fBN and sBN are names of those buttons.
allNull() makes fB,sB, fBN, sBN null.
function onClick(e:MouseEvent):void {
if (! another) {
another = true;
fB = e.target;
fBN = e.target.name;
}
else {
sB = e.target;
sBN = e.target.name;
if (fBN == sBN)
{
allNull();
}
else if (connected())
{
fB.removeEventListener(MouseEvent.MOUSE_DOWN, onClick);
sB.removeEventListener(MouseEvent.MOUSE_DOWN, onClick);
fB.alpha = 0;
sB.alpha = 0;
pairCount++;
allNull();
if (pairCount == 25)
{
gameOver = false;
showScore();
endGame();
}
}
another = false;
}
}
Please help. I am trying to solve this problem since 15 days.
Thanks in advance.